summaryrefslogtreecommitdiff
path: root/src/til_settings.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-30 18:51:57 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-30 18:51:57 -0700
commit9400a8491265b984c14469e1d711f3737748637d (patch)
tree9c14c24420406c4725b54eebbc5ff986eec3ccbe /src/til_settings.h
parentc91c9e5eeae06a7cbed94354d62c1281dc356407 (diff)
til_settings: add get_setting_by_{idx,key}() variants
Currently everything wanting to get a settings value goes through til_settings_get_value_by_{idx,key}() functions which return the value rather than the setting directly to the callers. This was a convenient thing initially, but it's becoming apparent that most of the setup_funcs using these actually need the til_setting_t* for improved error handling in the res_setup baking phase. So this commit basically just converts the existing functions into bare til_setting_t* returns, leaving the existing get_value variants as helper wrappers around them. Subsequent commits will rework the myriad setup_funcs to use the new variants, eventually letting setup front-ends like setup_interactively() to make use of the res_setting on res_setup baking failures too. For now both variants will coexist, during the reworking. The get_value variants may go away at some point if nothing is making use of them.
Diffstat (limited to 'src/til_settings.h')
-rw-r--r--src/til_settings.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/til_settings.h b/src/til_settings.h
index 0a72931..cbfc599 100644
--- a/src/til_settings.h
+++ b/src/til_settings.h
@@ -52,7 +52,9 @@ unsigned til_settings_get_count(const til_settings_t *settings);
const til_settings_t * til_settings_get_parent(const til_settings_t *settings);
int til_settings_set_label(til_settings_t *settings, const char *label);
const char * til_settings_get_label(const til_settings_t *settings);
+til_setting_t * til_settings_get_setting_by_key(const til_settings_t *settings, const char *key, til_setting_t **res_setting);
const char * til_settings_get_value_by_key(const til_settings_t *settings, const char *key, til_setting_t **res_setting);
+til_setting_t * til_settings_get_setting_by_idx(const til_settings_t *settings, unsigned idx, til_setting_t **res_setting);
const char * til_settings_get_value_by_idx(const til_settings_t *settings, unsigned idx, til_setting_t **res_setting);
til_setting_t * til_settings_add_value(til_settings_t *settings, const char *key, const char *value);
void til_settings_reset_descs(til_settings_t *settings);
© All Rights Reserved