dovecot-2.0: settings parser: Added support for setting name ali...

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 14 03:09:05 EET 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/17596238d8ea
changeset: 10467:17596238d8ea
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Dec 13 20:07:47 2009 -0500
description:
settings parser: Added support for setting name aliases.

diffstat:

2 files changed, 19 insertions(+), 1 deletion(-)
src/lib-settings/settings-parser.c |   17 +++++++++++++++++
src/lib-settings/settings-parser.h |    3 ++-

diffs (82 lines):

diff -r 3bcd4697a7cc -r 17596238d8ea src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Sun Dec 13 19:54:20 2009 -0500
+++ b/src/lib-settings/settings-parser.c	Sun Dec 13 20:07:47 2009 -0500
@@ -513,6 +513,11 @@ settings_parse(struct setting_parser_con
         void *ptr, *ptr2, *change_ptr;
 	const char *error;
 
+	while (def->type == SET_ALIAS) {
+		i_assert(def != link->info->defines);
+		def--;
+	}
+
 	ctx->prev_info = link->info;
 
 	if (link->set_struct == NULL) {
@@ -592,6 +597,9 @@ settings_parse(struct setting_parser_con
 			return -1;
 		break;
 	}
+	case SET_ALIAS:
+		i_unreached();
+		break;
 	}
 
 	if (change_ptr != NULL)
@@ -1020,6 +1028,7 @@ settings_var_expand_info(const struct se
 		case SET_STR:
 		case SET_ENUM:
 		case SET_STRLIST:
+		case SET_ALIAS:
 			break;
 		case SET_STR_VARS: {
 			const char **val = value;
@@ -1091,6 +1100,7 @@ bool settings_vars_have_key(const struct
 		case SET_STR:
 		case SET_ENUM:
 		case SET_STRLIST:
+		case SET_ALIAS:
 			break;
 		case SET_STR_VARS: {
 			const char *const *val = value;
@@ -1200,6 +1210,8 @@ setting_copy(enum setting_type type, con
 		}
 		break;
 	}
+	case SET_ALIAS:
+		break;
 	}
 	return TRUE;
 }
@@ -1291,6 +1303,8 @@ settings_changes_dup(const struct settin
 			}
 			break;
 		}
+		case SET_ALIAS:
+			break;
 		}
 	}
 	return dest_set;
@@ -1668,6 +1682,9 @@ settings_apply(struct setting_link *dest
 		} else if (*((const char *)csrc) == 0) {
 			/* unchanged */
 			continue;
+		} else if (def->type == SET_ALIAS) {
+			/* ignore aliases */
+			continue;
 		} else if (*((const char *)cdest) != 0) {
 			/* conflict */
 			if (conflict_key_r != NULL) {
diff -r 3bcd4697a7cc -r 17596238d8ea src/lib-settings/settings-parser.h
--- a/src/lib-settings/settings-parser.h	Sun Dec 13 19:54:20 2009 -0500
+++ b/src/lib-settings/settings-parser.h	Sun Dec 13 20:07:47 2009 -0500
@@ -26,7 +26,8 @@ enum setting_type {
 	SET_ENUM,
 	SET_DEFLIST, /* of type array_t */
 	SET_DEFLIST_UNIQUE,
-	SET_STRLIST /* of type ARRAY_TYPE(const_string) */
+	SET_STRLIST, /* of type ARRAY_TYPE(const_string) */
+	SET_ALIAS /* alias name for above setting definition */
 };
 #define SETTING_TYPE_IS_DEFLIST(type) \
 	((type) == SET_DEFLIST || (type) == SET_DEFLIST_UNIQUE)


More information about the dovecot-cvs mailing list