summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/til_settings.c18
-rw-r--r--src/til_settings.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/src/til_settings.c b/src/til_settings.c
index cdb5cd7..c546360 100644
--- a/src/til_settings.c
+++ b/src/til_settings.c
@@ -227,6 +227,24 @@ 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)
+{
+ char *t;
+
+ assert(settings);
+ assert(label);
+
+ t = strdup(label);
+ if (!t)
+ return -ENOMEM;
+
+ free((void *)settings->label);
+ settings->label = t;
+
+ return 0;
+}
+
+
/* 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 8339b63..6d14d20 100644
--- a/src/til_settings.h
+++ b/src/til_settings.h
@@ -49,6 +49,7 @@ til_settings_t * til_settings_new(const char *prefix, const til_settings_t *pare
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);
+int til_settings_set_label(til_settings_t *settings, const char *label);
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);
© All Rights Reserved