]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Move settings override "*" handling out of the loop
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 8 Apr 2025 09:23:48 +0000 (12:23 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 12 May 2025 15:51:47 +0000 (15:51 +0000)
This simplifies the code a bit.

src/lib-settings/settings.c

index efeced1d54ea335dd556ecde3638a49736c53301..822b20f0a7abcd1eb89632b44c0215df5cc8f886 100644 (file)
@@ -1792,6 +1792,14 @@ settings_override_filter_match(struct settings_apply_ctx *ctx,
            set_filter_names->value_type != EVENT_FIELD_VALUE_TYPE_STRLIST)
                set_filter_names = NULL;
 
+       if (set->filter == NULL &&
+           str_begins(set->key, "*"SETTINGS_SEPARATOR_S, &set->key)) {
+               /* always match, also for any named list filters */
+               set->filter_finished = TRUE;
+               set->always_match = TRUE;
+               return 1;
+       }
+
        bool filter_finished = TRUE;
        string_t *filter_string = NULL;
        const char *last_filter_key = set->last_filter_key;
@@ -1814,12 +1822,6 @@ settings_override_filter_match(struct settings_apply_ctx *ctx,
                           with all filters, which otherwise wouldn't be
                           visible to the settings override code. */
                        set_type = SET_FILTER_NAME;
-               } else if (strcmp(part, "*") == 0 && set->filter == NULL) {
-                       /* always match, also for any named list filters */
-                       set->filter_finished = TRUE;
-                       set->always_match = TRUE;
-                       set->key = p + 1;
-                       return 1;
                } else {
                        filter_finished = FALSE;
                        break;