dovecot-2.0: Added settings_parse_unalias().
dovecot at dovecot.org
dovecot at dovecot.org
Mon Apr 5 03:57:25 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/49c0232047f0
changeset: 11055:49c0232047f0
user: Timo Sirainen <tss at iki.fi>
date: Mon Apr 05 03:56:46 2010 +0300
description:
Added settings_parse_unalias().
diffstat:
src/lib-settings/settings-parser.c | 16 ++++++++++++++++
src/lib-settings/settings-parser.h | 4 ++++
2 files changed, 20 insertions(+), 0 deletions(-)
diffs (40 lines):
diff -r 373e2b3a050a -r 49c0232047f0 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c Mon Apr 05 03:07:14 2010 +0300
+++ b/src/lib-settings/settings-parser.c Mon Apr 05 03:56:46 2010 +0300
@@ -714,6 +714,22 @@
return settings_find_key(ctx, key, &def, &link);
}
+const char *settings_parse_unalias(struct setting_parser_context *ctx,
+ const char *key)
+{
+ const struct setting_define *def;
+ struct setting_link *link;
+
+ if (!settings_find_key(ctx, key, &def, &link))
+ return NULL;
+
+ while (def->type == SET_ALIAS) {
+ i_assert(def != link->info->defines);
+ def--;
+ }
+ return def->key;
+}
+
const void *
settings_parse_get_value(struct setting_parser_context *ctx,
const char *key, enum setting_type *type_r)
diff -r 373e2b3a050a -r 49c0232047f0 src/lib-settings/settings-parser.h
--- a/src/lib-settings/settings-parser.h Mon Apr 05 03:07:14 2010 +0300
+++ b/src/lib-settings/settings-parser.h Mon Apr 05 03:56:46 2010 +0300
@@ -124,6 +124,10 @@
/* Returns TRUE if the given key is a valid setting. */
bool settings_parse_is_valid_key(struct setting_parser_context *ctx,
const char *key);
+/* If key is an alias, return the primary key name. If key exists, return key
+ itself. If key doesn't exist, return NULL. */
+const char *settings_parse_unalias(struct setting_parser_context *ctx,
+ const char *key);
/* Returns pointer to value for a key, or NULL if not found. */
const void *
settings_parse_get_value(struct setting_parser_context *ctx,
More information about the dovecot-cvs
mailing list