From 3c64aca2f08387437ce886c09534061fb0b180b1 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 24 May 2023 23:16:58 -0700 Subject: til_settings: til_setting_t,til_settings_t get parent pointers Preparatory for constructing unique paths from a given setting/settings instance by walking up the tree --- src/til.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/til.c') diff --git a/src/til.c b/src/til.c index c00cf93..38daac8 100644 --- a/src/til.c +++ b/src/til.c @@ -330,7 +330,20 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se if (!module->setup) return 0; - settings = til_settings_new(module->name, NULL); + /* FIXME TODO: + * This seems wrong for two reasons: + * 1. There's no parent settings to attach this to, and there really shouldn't be such + * orphaned settings instances as we're supposed ot be able to influence their values + * externally via settings. At the very least this seems like it should be part of a + * heirarchy somewhere... which leads to #2 + * + * 2. Not only does lacking a parent suggest a problem, but there should be an incoming + * settings instance to randomize which may contain some values already set which we + * would skip randomizing. The settings don't currently have any kind of attributes or + * other state to indicate which ones should always be randomized vs. ones which were + * explicitly specified to stay fixed. + */ + settings = til_settings_new(NULL, module->name, NULL); if (!settings) return -ENOMEM; @@ -367,7 +380,7 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se return r; } - setting->value_as_nested_settings = til_settings_new(desc->spec.key ? : label, setting->value); + setting->value_as_nested_settings = til_settings_new(desc->container, desc->spec.key ? : label, setting->value); free(label); if (!setting->value_as_nested_settings) -- cgit v1.2.1