]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Move config_get_value()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 29 Jul 2025 11:31:53 +0000 (14:31 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Sun, 3 Aug 2025 17:22:44 +0000 (17:22 +0000)
src/config/config-parser.c

index b836816ce97dcf06ec72f375fe99eff42252c076..d61f9128c0bc7318a49380583c5af08d369ae36b 100644 (file)
@@ -340,6 +340,37 @@ config_apply_error(struct config_parser_context *ctx, const char *key)
        return 0;
 }
 
+static bool
+config_get_value(struct config_filter_parser *filter_parser,
+                struct config_parser_key *config_key,
+                const char *key, string_t *str)
+{
+       struct config_module_parser *l =
+               &filter_parser->module_parsers[config_key->info_idx];
+       const struct setting_define *def =
+               &l->info->defines[config_key->define_idx];
+       if (def->type == SET_STRLIST || def->type == SET_BOOLLIST ||
+           def->type == SET_FILTER_NAME || def->type == SET_FILTER_ARRAY)
+               return FALSE;
+
+       if (l->change_counters != NULL &&
+           l->change_counters[config_key->define_idx] != 0) {
+               str_append(str, l->settings[config_key->define_idx].str);
+               return TRUE;
+       }
+       if (filter_parser->parent == NULL) {
+               /* use the default setting */
+               const void *value = CONST_PTR_OFFSET(l->info->defaults,
+                                                    def->offset);
+               if (!config_export_type(str, value, def->type))
+                       i_unreached();
+               return TRUE;
+       }
+
+       /* not changed by this parser. maybe parent has. */
+       return config_get_value(filter_parser->parent, config_key, key, str);
+}
+
 static bool config_filter_has_include_group(const struct config_filter *filter)
 {
        for (; filter != NULL; filter = filter->parent) {
@@ -2416,37 +2447,6 @@ config_parse_finish(struct config_parser_context *ctx,
        return ret;
 }
 
-static bool
-config_get_value(struct config_filter_parser *filter_parser,
-                struct config_parser_key *config_key,
-                const char *key, string_t *str)
-{
-       struct config_module_parser *l =
-               &filter_parser->module_parsers[config_key->info_idx];
-       const struct setting_define *def =
-               &l->info->defines[config_key->define_idx];
-       if (def->type == SET_STRLIST || def->type == SET_BOOLLIST ||
-           def->type == SET_FILTER_NAME || def->type == SET_FILTER_ARRAY)
-               return FALSE;
-
-       if (l->change_counters != NULL &&
-           l->change_counters[config_key->define_idx] != 0) {
-               str_append(str, l->settings[config_key->define_idx].str);
-               return TRUE;
-       }
-       if (filter_parser->parent == NULL) {
-               /* use the default setting */
-               const void *value = CONST_PTR_OFFSET(l->info->defaults,
-                                                    def->offset);
-               if (!config_export_type(str, value, def->type))
-                       i_unreached();
-               return TRUE;
-       }
-
-       /* not changed by this parser. maybe parent has. */
-       return config_get_value(filter_parser->parent, config_key, key, str);
-}
-
 static int config_write_keyvariable(struct config_parser_context *ctx,
                                    const char *key, const char *value,
                                    string_t *str)