]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replace settings_parser_get() with settings_parser_get_root_set()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 4 Jan 2023 20:21:27 +0000 (22:21 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:11:40 +0000 (14:11 +0200)
src/config/config-request.c
src/config/doveconf.c
src/config/test-config-parser.c
src/lib-settings/test-settings-parser.c
src/stats/test-stats-common.c

index 4aef57014f928b14b7ba71823794555786be65bf..1bef31192b7ec45dcad489e0026f252abc3ab6cf 100644 (file)
@@ -488,8 +488,8 @@ int config_export_finish(struct config_export_context **_ctx,
                parser = &ctx->parsers[i];
 
                T_BEGIN {
-                       settings_export(ctx, parser->root, FALSE,
-                                       settings_parser_get(parser->parser),
+                       void *set = settings_parser_get_root_set(parser->parser, parser->root);
+                       settings_export(ctx, parser->root, FALSE, set,
                                        settings_parser_get_changes(parser->parser));
                } T_END;
 
index 62f507f1a4e108224c8849766cef7970d20fba83..3bd03ba3bb9310f5ad555f0293805d6ae03c36e1 100644 (file)
@@ -679,7 +679,7 @@ static const char *get_setting(const char *module, const char *name)
                if (strcmp(l->root->module_name, module) != 0)
                        continue;
 
-               set = settings_parser_get(l->parser);
+               set = settings_parser_get_root_set(l->parser, l->root);
                for (def = l->root->defines; def->key != NULL; def++) {
                        if (strcmp(def->key, name) == 0) {
                                value = CONST_PTR_OFFSET(set, def->offset);
index 9ed0ef41228c2e6b9360c9f8e4148b88318c5ef5..a10e29cee03300de9d4419ae588218dde877abb2 100644 (file)
@@ -123,7 +123,8 @@ static void test_config_parser(void)
 
        /* get the parsed output */
        const struct test_settings *set =
-               settings_parser_get(config_module_parsers[0].parser);
+               settings_parser_get_root_set(config_module_parsers[0].parser,
+                                            config_module_parsers[0].root);
        test_assert_strcmp(set->key, "value");
        test_assert_strcmp(set->key2, "\\$escape \\escape \\\"escape\\\"");
        test_assert_strcmp(set->key3, "yetanother value value nothervalue right here");
@@ -139,7 +140,8 @@ static void test_config_parser(void)
 
        /* try again unexpanded */
        test_assert(config_parse_file(TEST_CONFIG_FILE, 0, &error) == 1);
-       set = settings_parser_get(config_module_parsers[0].parser);
+       set = settings_parser_get_root_set(config_module_parsers[0].parser,
+                                          config_module_parsers[0].root);
 
        test_assert_strcmp(set->key, "value");
        test_assert_strcmp(set->key2, "\\$escape \\escape \\\"escape\\\"");
index e71c253dd8e00e09ddbc94e9078a0a714cd3719c..b9f3dbb30022d54c63d16b0b6de9bb42e2ca4c7b 100644 (file)
@@ -26,7 +26,7 @@ static const char *const test_settings_blobs[] =
        "strlist/z=c",
 };
 
-static void test_settings_parser_get(void)
+static void test_settings_parser(void)
 {
        struct test_settings {
                bool bool_true;
@@ -81,7 +81,7 @@ static void test_settings_parser_get(void)
                .parent_offset = SIZE_MAX,
        };
 
-       test_begin("settings_parser_get");
+       test_begin("settings_parser");
 
        pool_t pool = pool_alloconly_create("settings parser", 1024);
        struct setting_parser_context *ctx =
@@ -98,7 +98,8 @@ static void test_settings_parser_get(void)
        test_assert(settings_parser_check(ctx, pool, NULL));
 
        /* check what we got */
-       struct test_settings *settings = settings_parser_get(ctx);
+       struct test_settings *settings =
+               settings_parser_get_root_set(ctx, &root);
        test_assert(settings != NULL);
 
        test_assert(settings->bool_true == TRUE);
@@ -136,7 +137,7 @@ static void test_settings_parser_get(void)
 int main(void)
 {
        static void (*const test_functions[])(void) = {
-               test_settings_parser_get,
+               test_settings_parser,
                NULL
        };
        return test_run(test_functions);
index 5b2947d36891707b5399b0fa39dd04b6f6d6ddd2..d810ff7b1652a165bc48365a340277ac5507bc5b 100644 (file)
@@ -32,7 +32,8 @@ static struct stats_settings *read_settings(const char *const settings[])
        if (!settings_parser_check(ctx, test_pool, &error))
                i_fatal("Failed to parse settings: %s",
                        error);
-       struct stats_settings *set = settings_parser_get(ctx);
+       struct stats_settings *set =
+               settings_parser_get_root_set(ctx, &stats_setting_parser_info);
        settings_parser_unref(&ctx);
        return set;
 }