From: Timo Sirainen Date: Wed, 4 Jan 2023 20:21:27 +0000 (+0200) Subject: global: Replace settings_parser_get() with settings_parser_get_root_set() X-Git-Tag: 2.4.0~2355 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df502dc3b79ec6c8c152823bc167d51112b7157a;p=thirdparty%2Fdovecot%2Fcore.git global: Replace settings_parser_get() with settings_parser_get_root_set() --- diff --git a/src/config/config-request.c b/src/config/config-request.c index 4aef57014f..1bef31192b 100644 --- a/src/config/config-request.c +++ b/src/config/config-request.c @@ -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; diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 62f507f1a4..3bd03ba3bb 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -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); diff --git a/src/config/test-config-parser.c b/src/config/test-config-parser.c index 9ed0ef4122..a10e29cee0 100644 --- a/src/config/test-config-parser.c +++ b/src/config/test-config-parser.c @@ -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\\\""); diff --git a/src/lib-settings/test-settings-parser.c b/src/lib-settings/test-settings-parser.c index e71c253dd8..b9f3dbb300 100644 --- a/src/lib-settings/test-settings-parser.c +++ b/src/lib-settings/test-settings-parser.c @@ -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); diff --git a/src/stats/test-stats-common.c b/src/stats/test-stats-common.c index 5b2947d368..d810ff7b16 100644 --- a/src/stats/test-stats-common.c +++ b/src/stats/test-stats-common.c @@ -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; }