summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/setup.c6
-rw-r--r--src/til.c6
-rw-r--r--src/til_settings.c2
3 files changed, 8 insertions, 6 deletions
diff --git a/src/setup.c b/src/setup.c
index 8f9c5c1..5d99178 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -100,7 +100,7 @@ int setup_interactively(til_settings_t *settings, int (*setup_func)(const til_se
if (*buf == '\n') {
/* accept preferred */
- til_settings_add_value(settings, desc->spec.key, desc->spec.preferred, NULL);
+ til_settings_add_value(desc->container, desc->spec.key, desc->spec.preferred, NULL);
} else {
buf[strlen(buf) - 1] = '\0';
@@ -116,7 +116,7 @@ int setup_interactively(til_settings_t *settings, int (*setup_func)(const til_se
for (found = i = 0; desc->spec.values[i]; i++) {
if (i == j) {
- til_settings_add_value(settings, desc->spec.key, desc->spec.values[i], NULL);
+ til_settings_add_value(desc->container, desc->spec.key, desc->spec.values[i], NULL);
found = 1;
break;
}
@@ -131,7 +131,7 @@ int setup_interactively(til_settings_t *settings, int (*setup_func)(const til_se
} else {
/* use typed input as setting, TODO: apply regex */
- til_settings_add_value(settings, desc->spec.key, buf, NULL);
+ til_settings_add_value(desc->container, desc->spec.key, buf, NULL);
}
}
_next:
diff --git a/src/til.c b/src/til.c
index e1b4907..f5c2e8f 100644
--- a/src/til.c
+++ b/src/til.c
@@ -337,7 +337,7 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se
char *value;
value = desc->spec.random(rand_r(&seed));
- til_settings_add_value(settings, desc->spec.key, value, desc);
+ til_settings_add_value(desc->container, desc->spec.key, value, desc);
free(value);
} else if (desc->spec.values) {
int n;
@@ -346,9 +346,9 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se
n = rand_r(&seed) % n;
- til_settings_add_value(settings, desc->spec.key, desc->spec.values[n], desc);
+ til_settings_add_value(desc->container, desc->spec.key, desc->spec.values[n], desc);
} else {
- til_settings_add_value(settings, desc->spec.key, desc->spec.preferred, desc);
+ til_settings_add_value(desc->container, desc->spec.key, desc->spec.preferred, desc);
}
}
diff --git a/src/til_settings.c b/src/til_settings.c
index 4749372..4631849 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -363,6 +363,8 @@ int til_setting_desc_new(const til_settings_t *settings, const til_setting_spec_
if (!d)
return -ENOMEM;
+ /* XXX: intentionally casting away the const here, since the purpose of desc->container is to point where to actually put the setting for the front-end setup code */
+ d->container = (til_settings_t *)settings;
if (spec->name)
d->spec.name = strdup(spec->name);
© All Rights Reserved