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)
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);
removal->key_suffix = key;
}
/* keep it NULL-terminated for each access */
- boollist_null_terminate(array, FALSE);
+ settings_boollist_finish(array, FALSE);
return 0;
}
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 */
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. */