diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-07-02 15:58:58 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-07-04 21:09:16 -0700 |
commit | 5ce8f8184acdf5813a7e7c265d5fa814137ce677 (patch) | |
tree | 83e64cf0f4bc62691556f0add1c10476c626f638 /src | |
parent | 3c5db5339454f48edb48c9b1498c1832c6711eb1 (diff) |
til_settings: add ability to get at settings parent
Introduce til_settings_get_parent(), impetus being so
til_module_setup() can infer if it's hermetic-appropriate or not.
Diffstat (limited to 'src')
-rw-r--r-- | src/til_settings.c | 8 | ||||
-rw-r--r-- | src/til_settings.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/til_settings.c b/src/til_settings.c index fb71bf7..cdb5cd7 100644 --- a/src/til_settings.c +++ b/src/til_settings.c @@ -219,6 +219,14 @@ unsigned til_settings_get_count(const til_settings_t *settings) } +const til_settings_t * til_settings_get_parent(const til_settings_t *settings) +{ + assert(settings); + + return settings->parent; +} + + /* find key= in settings, return value NULL if missing, optionally store setting @res_setting if found */ const char * til_settings_get_value_by_key(const til_settings_t *settings, const char *key, til_setting_t **res_setting) { diff --git a/src/til_settings.h b/src/til_settings.h index 8cdaf88..8339b63 100644 --- a/src/til_settings.h +++ b/src/til_settings.h @@ -48,6 +48,7 @@ struct til_setting_t { til_settings_t * til_settings_new(const char *prefix, const til_settings_t *parent, const char *label, const char *settings); til_settings_t * til_settings_free(til_settings_t *settings); unsigned til_settings_get_count(const til_settings_t *settings); +const til_settings_t * til_settings_get_parent(const til_settings_t *settings); const char * til_settings_get_value_by_key(const til_settings_t *settings, const char *key, 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); |