dovecot-2.0: lib-settings: settings_check() now also checks dyna...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 25 17:03:47 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8d76b2cef0b5
changeset: 11632:8d76b2cef0b5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 25 15:02:57 2010 +0100
description:
lib-settings: settings_check() now also checks dynamic parsers.

diffstat:

 src/lib-settings/settings-parser.c |  22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r d41694c931d0 -r 8d76b2cef0b5 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Fri Jun 25 14:03:20 2010 +0100
+++ b/src/lib-settings/settings-parser.c	Fri Jun 25 15:02:57 2010 +0100
@@ -1027,6 +1027,26 @@
 	return ret;
 }
 
+static bool
+settings_check_dynamic(const struct setting_parser_info *info, pool_t pool,
+		       void *set, const char **error_r)
+{
+	unsigned int i;
+
+	if (info->dynamic_parsers == NULL)
+		return TRUE;
+
+	for (i = 0; info->dynamic_parsers[i].name != NULL; i++) {
+		struct dynamic_settings_parser *dyn = &info->dynamic_parsers[i];
+
+		if (!settings_check(dyn->info, pool,
+				    PTR_OFFSET(set, dyn->struct_offset),
+				    error_r))
+			return FALSE;
+	}
+	return TRUE;
+}
+
 bool settings_check(const struct setting_parser_info *info, pool_t pool,
 		    void *set, const char **error_r)
 {
@@ -1055,7 +1075,7 @@
 				return FALSE;
 		}
 	}
-	return TRUE;
+	return settings_check_dynamic(info, pool, set, error_r);
 }
 
 bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,


More information about the dovecot-cvs mailing list