From 9d4abba0d4f80b691cffea53322f0a4912653d25 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 28 Mar 2022 13:57:45 -0700 Subject: til_settings: provide a user_data pointer w/til_setting_t Particularly in implementing a stateful/"retained" GUI it can be desirable to embed something like a widget pointer in a til_setting_t once described and shown to the user. Management of this pointer is largely nonexistant from the libtil perspective. It's simply initialized to NULL when a new setting is added, and never accessed again. 100% the caller's responsibility. This works fine since libtil/til_settings_t only accumulates til_setting_t entries and never removes them except when discarding an entire til_settings_t wholesale. --- src/til_settings.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/til_settings.c') diff --git a/src/til_settings.c b/src/til_settings.c index 0c2eff1..a1466d9 100644 --- a/src/til_settings.c +++ b/src/til_settings.c @@ -53,6 +53,7 @@ static int add_value(til_settings_t *settings, const char *key, const char *valu settings->settings[settings->num - 1]->key = key; settings->settings[settings->num - 1]->value = value; settings->settings[settings->num - 1]->desc = desc; + settings->settings[settings->num - 1]->user_data = NULL; return 0; } -- cgit v1.2.1