From b9123bbb0b09cb0b30dd0a08f48caecfbb15f9c2 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 26 May 2023 17:21:35 -0700 Subject: til: more setup desc handling fixups 7ff8ef94 switched things to always describe relevant settings, but left some loose ends. Obvious fixups for those --- src/til.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/til.c b/src/til.c index fad9383..3b51e24 100644 --- a/src/til.c +++ b/src/til.c @@ -272,7 +272,7 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting const char *name; name = til_settings_get_value_by_idx(settings, 0, &setting); - if (!name) { + if (!name || !setting->desc) { const char *values[nelems(modules) + 1] = {}; const char *annotations[nelems(modules) + 1] = {}; til_setting_desc_t *desc; @@ -331,13 +331,13 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se return 0; /* 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 + * 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 + * 2. not only does lacking a parent suggests 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 @@ -388,6 +388,8 @@ int til_module_randomize_setup(const til_module_t *module, unsigned seed, til_se if (!setting->value_as_nested_settings) return -ENOMEM; } + + setting->desc = desc; } if (res_arg) { -- cgit v1.2.3