Mercurial > dovecot > core-2.2
changeset 19031:224f0f61d03f
lib-settings: Added settings_var_expand_with_funcs()
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 28 Aug 2015 15:43:45 +0200 |
parents | 061c21b5c5e4 |
children | 65b88128c7eb |
files | src/lib-settings/settings-parser.c src/lib-settings/settings-parser.h |
diffstat | 2 files changed, 25 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-settings/settings-parser.c Fri Aug 28 15:07:35 2015 +0200 +++ b/src/lib-settings/settings-parser.c Fri Aug 28 15:43:45 2015 +0200 @@ -1211,7 +1211,9 @@ static void ATTR_NULL(3, 4, 5) settings_var_expand_info(const struct setting_parser_info *info, void *set, pool_t pool, - const struct var_expand_table *table, string_t *str) + const struct var_expand_table *table, + const struct var_expand_func_table *func_table, + void *func_context, string_t *str) { const struct setting_define *def; void *value, *const *children; @@ -1242,7 +1244,8 @@ *val += 1; } else if (**val == SETTING_STRVAR_UNEXPANDED[0]) { str_truncate(str, 0); - var_expand(str, *val + 1, table); + var_expand_with_funcs(str, *val + 1, table, + func_table, func_context); *val = p_strdup(pool, str_c(str)); } else { i_assert(**val == SETTING_STRVAR_EXPANDED[0]); @@ -1260,8 +1263,8 @@ children = array_get(val, &count); for (i = 0; i < count; i++) { settings_var_expand_info(def->list_info, - children[i], pool, - table, str); + children[i], pool, table, func_table, + func_context, str); } break; } @@ -1273,11 +1276,21 @@ void *set, pool_t pool, const struct var_expand_table *table) { + return settings_var_expand_with_funcs(info, set, pool, table, NULL, NULL); +} + +void settings_var_expand_with_funcs(const struct setting_parser_info *info, + void *set, pool_t pool, + const struct var_expand_table *table, + const struct var_expand_func_table *func_table, + void *func_context) +{ string_t *str; T_BEGIN { str = t_str_new(256); - settings_var_expand_info(info, set, pool, table, str); + settings_var_expand_info(info, set, pool, table, + func_table, func_context, str); } T_END; } @@ -1288,7 +1301,7 @@ for (i = 0; i < ctx->root_count; i++) { settings_var_expand_info(ctx->roots[i].info, ctx->roots[i].set_struct, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); } }
--- a/src/lib-settings/settings-parser.h Fri Aug 28 15:07:35 2015 +0200 +++ b/src/lib-settings/settings-parser.h Fri Aug 28 15:43:45 2015 +0200 @@ -2,6 +2,7 @@ #define SETTINGS_PARSER_H struct var_expand_table; +struct var_expand_func_table; #define SETTINGS_SEPARATOR '/' #define SETTINGS_SEPARATOR_S "/" @@ -178,6 +179,11 @@ void settings_var_expand(const struct setting_parser_info *info, void *set, pool_t pool, const struct var_expand_table *table); +void settings_var_expand_with_funcs(const struct setting_parser_info *info, + void *set, pool_t pool, + const struct var_expand_table *table, + const struct var_expand_func_table *func_table, + void *func_context); /* Go through all the settings and return the first one that has an unexpanded setting containing the given %key. */ bool settings_vars_have_key(const struct setting_parser_info *info, void *set,