]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Set module parsers inside config_dump_human_init()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 23 Nov 2023 19:40:49 +0000 (21:40 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
Deduplicates the code a bit.

src/config/doveconf.c

index bb5f1749aceff4cdee08e7738f778ea2c1ea533e..dd7da5b34f639ddb716d81deeead02bb2e5b78df 100644 (file)
@@ -130,7 +130,8 @@ static struct prefix_stack prefix_stack_pop(ARRAY_TYPE(prefix_stack) *stack)
 }
 
 static struct config_dump_human_context *
-config_dump_human_init(enum config_dump_scope scope)
+config_dump_human_init(enum config_dump_scope scope,
+                      struct config_filter_parser *filter_parser)
 {
        struct config_dump_human_context *ctx;
        enum config_dump_flags flags;
@@ -145,6 +146,8 @@ config_dump_human_init(enum config_dump_scope scope)
        flags = CONFIG_DUMP_FLAG_DEDUPLICATE_KEYS;
        ctx->export_ctx = config_export_init(scope, flags,
                                             config_request_get_strings, ctx);
+       config_export_set_module_parsers(ctx->export_ctx,
+                                        filter_parser->module_parsers);
        return ctx;
 }
 
@@ -640,12 +643,10 @@ config_dump_human_filter_path(enum config_dump_scope scope,
                bool sub_hide_passwords = set_name_filter != NULL ?
                        FALSE : hide_passwords;
 
-               ctx = config_dump_human_init(scope);
+               ctx = config_dump_human_init(scope, filter_parser);
                sub_indent = hide_key ? 0 :
                        config_dump_filter_begin(list_prefix, indent,
                                                 &filter_parser->filter);
-               config_export_set_module_parsers(ctx->export_ctx,
-                                                filter_parser->module_parsers);
                str_append_str(ctx->list_prefix, list_prefix);
                const char *filter_key =
                        !filter_parser->filter.filter_name_array ? NULL :
@@ -698,9 +699,7 @@ config_dump_human(enum config_dump_scope scope,
 
        /* Check for the setting always even with a filter - it might be
           e.g. plugin/key strlist */
-       ctx = config_dump_human_init(scope);
-       config_export_set_module_parsers(ctx->export_ctx,
-                                        filter_parser->module_parsers);
+       ctx = config_dump_human_init(scope, filter_parser);
        config_dump_human_output(ctx, output, 0, setting_name_filter, NULL,
                                 hide_key, hide_passwords, NULL);
        config_dump_human_deinit(ctx);