dovecot-1.3: settings_parser_info.check_func() now gets pool par...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 8 05:25:58 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/0145ecc95752
changeset: 9045:0145ecc95752
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 07 22:17:36 2009 -0400
description:
settings_parser_info.check_func() now gets pool parameter if it wants to change settings.

diffstat:

8 files changed, 31 insertions(+), 25 deletions(-)
src/auth/auth-settings.c                |    6 +++---
src/config/config-parser.c              |    2 +-
src/imap/imap-settings.c                |    7 ++++---
src/lib-settings/settings-parser.c      |   13 +++++++------
src/lib-settings/settings-parser.h      |    4 ++--
src/lib-storage/mail-storage-settings.c |   10 ++++++----
src/login-common/login-settings.c       |    7 ++++---
src/pop3/pop3-settings.c                |    7 ++++---

diffs (239 lines):

diff -r 967bfafe6c0a -r 0145ecc95752 src/auth/auth-settings.c
--- a/src/auth/auth-settings.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/auth/auth-settings.c	Tue Apr 07 22:17:36 2009 -0400
@@ -12,7 +12,7 @@ extern struct setting_parser_info auth_s
 extern struct setting_parser_info auth_setting_parser_info;
 extern struct setting_parser_info auth_root_setting_parser_info;
 
-static bool auth_settings_check(void *_set, const char **error_r);
+static bool auth_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -287,7 +287,7 @@ static void fix_base_path(struct auth_se
 }
 
 /* <settings checks> */
-static bool auth_settings_check(void *_set ATTR_UNUSED,
+static bool auth_settings_check(void *_set ATTR_UNUSED, pool_t pool ATTR_UNUSED,
 				const char **error_r ATTR_UNUSED)
 {
 #ifndef CONFIG_BINARY
@@ -341,7 +341,7 @@ struct auth_settings *auth_settings_read
 			settings_parser_get_error(parser));
 	}
 
-	if (settings_parser_check(parser, &error) < 0)
+	if (settings_parser_check(parser, settings_pool, &error) < 0)
 		i_fatal("Invalid settings: %s", error);
 
 	set = settings_parser_get(parser);
diff -r 967bfafe6c0a -r 0145ecc95752 src/config/config-parser.c
--- a/src/config/config-parser.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/config/config-parser.c	Tue Apr 07 22:17:36 2009 -0400
@@ -526,7 +526,7 @@ prevfile:
 		if (l->parser == NULL)
 			continue;
 
-		if (!settings_parser_check(l->parser, &errormsg)) {
+		if (!settings_parser_check(l->parser, pool, &errormsg)) {
 			i_fatal("Error in configuration file %s: %s",
 				path, errormsg);
 		}
diff -r 967bfafe6c0a -r 0145ecc95752 src/imap/imap-settings.c
--- a/src/imap/imap-settings.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/imap/imap-settings.c	Tue Apr 07 22:17:36 2009 -0400
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-static bool imap_settings_check(void *_set, const char **error_r);
+static bool imap_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #undef DEFLIST
@@ -85,7 +85,8 @@ static void fix_base_path(struct imap_se
 }
 
 /* <settings checks> */
-static bool imap_settings_check(void *_set, const char **error_r)
+static bool imap_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+				const char **error_r)
 {
 	struct imap_settings *set = _set;
 
@@ -157,7 +158,7 @@ void imap_settings_read(const struct ima
 	if (value != NULL)
 		parse_expand_vars(parser, value);
 
-	if (settings_parser_check(parser, &error) < 0)
+	if (settings_parser_check(parser, settings_pool, &error) < 0)
 		i_fatal("Invalid settings: %s", error);
 
 	sets = settings_parser_get_list(parser);
diff -r 967bfafe6c0a -r 0145ecc95752 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/lib-settings/settings-parser.c	Tue Apr 07 22:17:36 2009 -0400
@@ -642,8 +642,9 @@ int settings_parse_exec(struct setting_p
 	return ret;
 }
 
-static bool settings_parser_check_info(const struct setting_parser_info *info,
-				       void *set, const char **error_r)
+static bool
+settings_parser_check_info(const struct setting_parser_info *info, pool_t pool,
+			   void *set, const char **error_r)
 {
 	const struct setting_define *def;
 	const ARRAY_TYPE(void_array) *val;
@@ -651,7 +652,7 @@ static bool settings_parser_check_info(c
 	unsigned int i, count;
 
 	if (info->check_func != NULL) {
-		if (!info->check_func(set, error_r))
+		if (!info->check_func(set, pool, error_r))
 			return FALSE;
 	}
 
@@ -665,7 +666,7 @@ static bool settings_parser_check_info(c
 
 		children = array_get(val, &count);
 		for (i = 0; i < count; i++) {
-			if (!settings_parser_check_info(def->list_info,
+			if (!settings_parser_check_info(def->list_info, pool,
 							children[i], error_r))
 				return FALSE;
 		}
@@ -673,13 +674,13 @@ static bool settings_parser_check_info(c
 	return TRUE;
 }
 
-bool settings_parser_check(struct setting_parser_context *ctx,
+bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,
 			   const char **error_r)
 {
 	unsigned int i;
 
 	for (i = 0; i < ctx->root_count; i++) {
-		if (!settings_parser_check_info(ctx->roots[i].info,
+		if (!settings_parser_check_info(ctx->roots[i].info, pool,
 						ctx->roots[i].set_struct,
 						error_r))
 		    return FALSE;
diff -r 967bfafe6c0a -r 0145ecc95752 src/lib-settings/settings-parser.h
--- a/src/lib-settings/settings-parser.h	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/lib-settings/settings-parser.h	Tue Apr 07 22:17:36 2009 -0400
@@ -57,7 +57,7 @@ struct setting_parser_info {
 	size_t parent_offset;
 	size_t type_offset;
 	size_t struct_size;
-	bool (*check_func)(void *set, const char **error_r);
+	bool (*check_func)(void *set, pool_t pool, const char **error_r);
 };
 ARRAY_DEFINE_TYPE(setting_parser_info, struct setting_parser_info);
 
@@ -120,7 +120,7 @@ int settings_parse_exec(struct setting_p
 			const char *bin_path, const char *config_path,
 			const char *service);
 /* Call all check_func()s to see if currently parsed settings are valid. */
-bool settings_parser_check(struct setting_parser_context *ctx,
+bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,
 			   const char **error_r);
 
 /* While parsing values, specifies if STR_VARS strings are already expanded. */
diff -r 967bfafe6c0a -r 0145ecc95752 src/lib-storage/mail-storage-settings.c
--- a/src/lib-storage/mail-storage-settings.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/lib-storage/mail-storage-settings.c	Tue Apr 07 22:17:36 2009 -0400
@@ -11,8 +11,8 @@
 
 #include <stddef.h>
 
-static bool mail_storage_settings_check(void *_set, const char **error_r);
-static bool namespace_settings_check(void *_set, const char **error_r);
+static bool mail_storage_settings_check(void *_set, pool_t pool, const char **error_r);
+static bool namespace_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -213,7 +213,8 @@ void mail_storage_namespace_defines_init
 }
 
 /* <settings checks> */
-static bool mail_storage_settings_check(void *_set, const char **error_r)
+static bool mail_storage_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+					const char **error_r)
 {
 	const struct mail_storage_settings *set = _set;
 
@@ -228,7 +229,8 @@ static bool mail_storage_settings_check(
 	return TRUE;
 }
 
-static bool namespace_settings_check(void *_set, const char **error_r)
+static bool namespace_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+				     const char **error_r)
 {
 	struct mail_namespace_settings *ns = _set;
 	struct mail_namespace_settings *const *namespaces;
diff -r 967bfafe6c0a -r 0145ecc95752 src/login-common/login-settings.c
--- a/src/login-common/login-settings.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/login-common/login-settings.c	Tue Apr 07 22:17:36 2009 -0400
@@ -7,7 +7,7 @@
 #include <stddef.h>
 #include <unistd.h>
 
-static bool login_settings_check(void *_set, const char **error_r);
+static bool login_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -137,7 +137,8 @@ static int ssl_settings_check(void *_set
 #endif
 }
 
-static bool login_settings_check(void *_set, const char **error_r)
+static bool login_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+				 const char **error_r)
 {
 	struct login_settings *set = _set;
 
@@ -191,7 +192,7 @@ struct login_settings *login_settings_re
 			settings_parser_get_error(parser));
 	}
 
-	if (settings_parser_check(parser, &error) < 0)
+	if (settings_parser_check(parser, settings_pool, &error) < 0)
 		i_fatal("Invalid settings: %s", error);
 
 	set = settings_parser_get(parser);
diff -r 967bfafe6c0a -r 0145ecc95752 src/pop3/pop3-settings.c
--- a/src/pop3/pop3-settings.c	Tue Apr 07 20:48:53 2009 -0400
+++ b/src/pop3/pop3-settings.c	Tue Apr 07 22:17:36 2009 -0400
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-static bool pop3_settings_check(void *_set, const char **error_r);
+static bool pop3_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #undef DEFLIST
@@ -84,7 +84,8 @@ static void fix_base_path(struct pop3_se
 }
 
 /* <settings checks> */
-static bool pop3_settings_check(void *_set, const char **error_r)
+static bool pop3_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+				const char **error_r)
 {
 	struct pop3_settings *set = _set;
 
@@ -156,7 +157,7 @@ void pop3_settings_read(const struct pop
 	if (value != NULL)
 		parse_expand_vars(parser, value);
 
-	if (settings_parser_check(parser, &error) < 0)
+	if (settings_parser_check(parser, settings_pool, &error) < 0)
 		i_fatal("Invalid settings: %s", error);
 
 	sets = settings_parser_get_list(parser);


More information about the dovecot-cvs mailing list