]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Added settings_var_expand_with_funcs()
authorTimo Sirainen <tss@iki.fi>
Fri, 28 Aug 2015 13:43:45 +0000 (15:43 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 28 Aug 2015 13:43:45 +0000 (15:43 +0200)
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index dc48739e5260601a81dd2545c163e8d63bb60182..6c3e9d5234ad6948d2912d457c6dca6c53e59867 100644 (file)
@@ -1211,7 +1211,9 @@ void settings_parse_set_keys_expandeded(struct setting_parser_context *ctx,
 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 @@ settings_var_expand_info(const struct setting_parser_info *info, void *set,
                                *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 @@ settings_var_expand_info(const struct setting_parser_info *info, void *set,
                        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;
                }
@@ -1272,12 +1275,22 @@ settings_var_expand_info(const struct setting_parser_info *info, void *set,
 void settings_var_expand(const struct setting_parser_info *info,
                         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 @@ void settings_parse_var_skip(struct setting_parser_context *ctx)
        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);
        }
 }
 
index 6210c2566c2eb10cb5f10e96cf210d51ac205c69..90b81581cd7e29ecd652dad40fd5d12a45c24d72 100644 (file)
@@ -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_parse_var_skip(struct setting_parser_context *ctx);
 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,