summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-08-10 16:24:04 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-05-11 15:12:48 -0700
commite0e2ef79c1a44e241bc324abe242c397d1d0c6ac (patch)
tree148348ec91d25154583346dbc1da1162b9b600a0 /src
parent886fb547a3bda848a8b8e1db2b74ae4293c9ccb2 (diff)
til_settings: add til_settings_t.value_as_nested_settings
Preparatory commit for settings hierarchies.
Diffstat (limited to 'src')
-rw-r--r--src/til_settings.c3
-rw-r--r--src/til_settings.h3
2 files changed, 3 insertions, 3 deletions
diff --git a/src/til_settings.c b/src/til_settings.c
index 9fce32f..b4da4fd 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -52,11 +52,10 @@ static int add_value(til_settings_t *settings, const char *key, const char *valu
settings->num++;
/* TODO errors */
settings->settings = realloc(settings->settings, settings->num * sizeof(til_setting_t *));
- settings->settings[settings->num - 1] = malloc(sizeof(til_setting_t));
+ settings->settings[settings->num - 1] = calloc(1, sizeof(til_setting_t));
settings->settings[settings->num - 1]->key = key;
settings->settings[settings->num - 1]->value = value;
settings->settings[settings->num - 1]->desc = desc;
- settings->settings[settings->num - 1]->user_data = NULL;
return 0;
}
diff --git a/src/til_settings.h b/src/til_settings.h
index 93c0ed8..d4822be 100644
--- a/src/til_settings.h
+++ b/src/til_settings.h
@@ -25,8 +25,9 @@ typedef struct til_setting_desc_generator_t {
int (*func)(til_setup_t *setup_context, const til_setting_desc_t **res_desc);
} til_setting_desc_generator_t;
-/* Encapsulates a single til_settings_t entry */
+/* Encapsulates a single til_settings_t.settings[] entry */
struct til_setting_t {
+ til_settings_t *value_as_nested_settings; /* XXX: non-NULL when setup turned this setting's value into a nested settings instance */
const char *key;
const char *value;
const til_setting_desc_t *desc;
© All Rights Reserved