]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Rename boollist_null_terminate() to public settings_boollist_finish()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Aug 2024 08:40:05 +0000 (11:40 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:39:59 +0000 (10:39 +0200)
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index 05115500dbd1eb3305d1e613ee5e1abe5f3a33b0..48a336685f1c1b77e7cef9844bf6e8053f0c3e5e 100644 (file)
@@ -487,7 +487,7 @@ const char *settings_file_get_value(pool_t pool,
        return value;
 }
 
-static void boollist_null_terminate(ARRAY_TYPE(const_string) *array, bool stop)
+void settings_boollist_finish(ARRAY_TYPE(const_string) *array, bool stop)
 {
        array_append_zero(array);
        if (stop)
@@ -532,7 +532,7 @@ settings_parse_boollist(struct setting_parser_context *ctx,
                        return -1;
                }
                /* keep it NULL-terminated for each access */
-               boollist_null_terminate(array, FALSE);
+               settings_boollist_finish(array, FALSE);
                return 0;
        }
        key = settings_section_unescape(key + 1);
@@ -563,7 +563,7 @@ settings_parse_boollist(struct setting_parser_context *ctx,
                removal->key_suffix = key;
        }
        /* keep it NULL-terminated for each access */
-       boollist_null_terminate(array, FALSE);
+       settings_boollist_finish(array, FALSE);
        return 0;
 }
 
@@ -808,7 +808,7 @@ void settings_parse_array_stop(struct setting_parser_context *ctx,
                p_array_init(arr, ctx->set_pool, 1);
 
        if (ctx->info->defines[key_idx].type == SET_BOOLLIST)
-               boollist_null_terminate(arr, TRUE);
+               settings_boollist_finish(arr, TRUE);
        else {
                /* Use the next element hidden after the array to keep
                   the stop-state */
index fda448392b58899b9412525ac1a5beee1480d06e..204621b20b1cfe1c750dc960b67a21c81ccc3921 100644 (file)
@@ -257,6 +257,11 @@ int settings_parse_boollist_string(const char *value, pool_t pool,
    terminated arrays, use this function instead. Also, it includes some sanity
    checks to try to make sure it's used only for boollists. */
 const char *const *settings_boollist_get(const ARRAY_TYPE(const_string) *array);
+/* Finish array into a boollist type by adding NULL-termination and optional
+   stop flag. If stop=TRUE, this indicates that the boollist replaces the full
+   list instead of adding to it. The boollist can still be updated afterwards,
+   as long as this function is called again after modifications. */
+void settings_boollist_finish(ARRAY_TYPE(const_string) *array, bool stop);
 
 /* Split the settings value into path and content. The path is allocated from
    the path_pool, while content points directly to the value string. */