]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings, config: Add and use SETTINGS_FILTER_ARRAY_SEPARATORS
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 7 Oct 2024 11:51:55 +0000 (14:51 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:16 +0000 (12:34 +0200)
src/config/config-parser.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h
src/lib-settings/settings.c

index d72f6da0cfd862d1aae6b57c847761d7789010dc..5d928b295ad4e22e4d21a4f72d51c996084756e6 100644 (file)
@@ -660,7 +660,8 @@ static int config_apply_filter_array(struct config_parser_context *ctx,
                                     const char *value,
                                     ARRAY_TYPE(const_string) **namesp)
 {
-       const char *const *list = t_strsplit(value, ",\t ");
+       const char *const *list =
+               t_strsplit(value, SETTINGS_FILTER_ARRAY_SEPARATORS);
        unsigned int i, count = str_array_length(list);
 
        if (line != NULL && line->type != CONFIG_LINE_TYPE_SECTION_BEGIN) {
index b52d699fddd06b3b06608d98abb53c8026b8ed84..c02a44649bf823fc30855a074934ddd110acf730 100644 (file)
@@ -735,7 +735,8 @@ settings_parse(struct setting_parser_context *ctx,
                   by giving e.g. "namespace+=newname" without it removing the
                   existing ones. */
                ARRAY_TYPE(const_string) *arr = ptr;
-               const char *const *list = t_strsplit(value, ",\t ");
+               const char *const *list =
+                       t_strsplit(value, SETTINGS_FILTER_ARRAY_SEPARATORS);
                unsigned int i, count = str_array_length(list);
                if (!array_is_created(arr))
                        p_array_init(arr, ctx->set_pool, count);
index a84394b961aae8d18d89005f24db66f17ba9a73c..1c23ee1edf88a3f9388a23ffe1afd5b14f6a6d0e 100644 (file)
@@ -9,6 +9,8 @@ struct var_expand_provider;
 #define SETTINGS_SEPARATOR '/'
 #define SETTINGS_SEPARATOR_S "/"
 
+#define SETTINGS_FILTER_ARRAY_SEPARATORS ",\t "
+
 /* These values are shown as "unlimited" */
 #define SET_VALUE_UNLIMITED "unlimited"
 #define SET_UINT_UNLIMITED UINT_MAX
index 681823b5a23c5a8395512823a1c7a158da4643c0..f90b9f4e21fad31cc343c4ec4aa884f8dea867dd 100644 (file)
@@ -1693,7 +1693,8 @@ settings_instance_override_add_default(struct settings_apply_ctx *ctx,
             next settings_get_filter() could be trying to look up this filter
             and it won't know enough to build the event filter.
        */
-       const char *const *items = t_strsplit(array_set->value, ",\t ");
+       const char *const *items =
+               t_strsplit(array_set->value, SETTINGS_FILTER_ARRAY_SEPARATORS);
        for (unsigned int i = 0; items[i] != NULL; i++) {
                struct settings_override *set =
                        array_append_space(array_set->overrides_array);