From 09906cbbad8a1fe1ad442110dbeabff63540d656 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 7 Aug 2024 11:03:10 -0400 Subject: ini_getval: expand template variables immediately before processing the output * Strip leading space to avoid issues with string comparisons against the result --- src/ini.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/ini.c b/src/ini.c index efc94e5..37d80fe 100644 --- a/src/ini.c +++ b/src/ini.c @@ -122,6 +122,14 @@ int ini_getval(struct INIFILE *ini, char *section_name, char *key, int type, uni result->as_char_p = NULL; return -1; } + + char *render = tpl_render(data->value); + if (render) { + guard_free(data->value); + data->value = render; + } + lstrip(data->value); + switch (type) { case INIVAL_TYPE_CHAR: result->as_char = (char) strtol(data->value, NULL, 10); -- cgit