From 0031692b1d5a7cf3e3cae4b5c6960b9d2c95359f Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sun, 17 Aug 2008 22:54:18 +0200
Subject: [PATCH] Cleaned up regex extension.

---
 src/lib-sieve/plugins/regex/ext-regex-common.c |  3 +++
 src/lib-sieve/plugins/regex/ext-regex-common.h | 17 ++++++++++++++++-
 src/lib-sieve/plugins/regex/ext-regex.c        | 13 ++++++-------
 src/lib-sieve/plugins/regex/mcht-regex.c       | 17 ++++++++++-------
 4 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/lib-sieve/plugins/regex/ext-regex-common.c b/src/lib-sieve/plugins/regex/ext-regex-common.c
index fd95c1a42..375217416 100644
--- a/src/lib-sieve/plugins/regex/ext-regex-common.c
+++ b/src/lib-sieve/plugins/regex/ext-regex-common.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
+ */
+
 #include "sieve-common.h"
 #include "sieve-match-types.h"
 
diff --git a/src/lib-sieve/plugins/regex/ext-regex-common.h b/src/lib-sieve/plugins/regex/ext-regex-common.h
index e2399e9a3..cc638b69b 100644
--- a/src/lib-sieve/plugins/regex/ext-regex-common.h
+++ b/src/lib-sieve/plugins/regex/ext-regex-common.h
@@ -1,12 +1,27 @@
+/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
+ */
+
 #ifndef __EXT_REGEX_COMMON_H
 #define __EXT_REGEX_COMMON_H
 
+/*
+ * Extension
+ */
+
 const struct sieve_extension regex_extension;
 
+/*
+ * Operand
+ */
+
 const struct sieve_operand regex_match_type_operand;
 
+/*
+ * Match type
+ */
+
 extern const struct sieve_match_type regex_match_type;
 
-#endif
+#endif /* __EXT_REGEX_COMMON_H */
 
 
diff --git a/src/lib-sieve/plugins/regex/ext-regex.c b/src/lib-sieve/plugins/regex/ext-regex.c
index ede583fb5..6e246d776 100644
--- a/src/lib-sieve/plugins/regex/ext-regex.c
+++ b/src/lib-sieve/plugins/regex/ext-regex.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
+ */
+
 /* Extension regex 
  * ---------------
  *
@@ -36,13 +39,13 @@
 #include <sys/types.h>
 #include <regex.h>
 
-/* Forward declarations */
+/* 
+ * Extension
+ */
 
 static bool ext_regex_load(int ext_id);
 static bool ext_regex_validator_load(struct sieve_validator *validator);
 
-/* Extension definitions */
-
 static int ext_my_id;
 
 const struct sieve_extension regex_extension = { 
@@ -62,10 +65,6 @@ static bool ext_regex_load(int ext_id)
 	return TRUE;
 }
 
-/* 
- * Load extension into validator 
- */
-
 static bool ext_regex_validator_load(struct sieve_validator *validator)
 {
 	sieve_match_type_register(validator, &regex_match_type); 
diff --git a/src/lib-sieve/plugins/regex/mcht-regex.c b/src/lib-sieve/plugins/regex/mcht-regex.c
index a7935c2f1..cd4b41b44 100644
--- a/src/lib-sieve/plugins/regex/mcht-regex.c
+++ b/src/lib-sieve/plugins/regex/mcht-regex.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
+ */
+
 /* Match-type ':regex'
  */
 
@@ -29,8 +32,12 @@
 #define MCHT_REGEX_MAX_SUBSTITUTIONS SIEVE_MAX_MATCH_VALUES
 
 /* 
- * Forward declarations 
+ * Match type
  */
+ 
+bool mcht_regex_validate_context
+(struct sieve_validator *validator, struct sieve_ast_argument *arg,
+    struct sieve_match_type_context *ctx, struct sieve_ast_argument *key_arg);
 
 static void mcht_regex_match_init(struct sieve_match_context *mctx);
 static int mcht_regex_match
@@ -38,10 +45,6 @@ static int mcht_regex_match
     	const char *key, size_t key_size, int key_index);
 static int mcht_regex_match_deinit(struct sieve_match_context *mctx);
 
-bool mcht_regex_validate_context
-(struct sieve_validator *validator, struct sieve_ast_argument *arg,
-    struct sieve_match_type_context *ctx, struct sieve_ast_argument *key_arg);
-
 const struct sieve_match_type regex_match_type = {
 	SIEVE_OBJECT("regex", &regex_match_type_operand, 0),
 	TRUE, FALSE,
@@ -53,7 +56,7 @@ const struct sieve_match_type regex_match_type = {
 };
 
 /* 
- * Match-type validation 
+ * Match type validation 
  */
 
 /* Wrapper around the regerror function for easy access */
@@ -160,7 +163,7 @@ bool mcht_regex_validate_context
 }
 
 /* 
- * Match-type implementation 
+ * Match type implementation 
  */
 
 struct mcht_regex_context {
-- 
GitLab