From 5960718075f5941436629ebfaced3997fe83036b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 4 Jan 2018 15:47:12 +0100 Subject: parse-xml.c: add get_bool() function The boolean "autogroup" was parsed as an integer. In principle OK, but let's make the type more explicit by introducing a get_bool() function. Suggested-by: "Lubomir I. Ivanov" Signed-off-by: Berthold Stoeger --- core/parse-xml.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/parse-xml.c b/core/parse-xml.c index 3f8f16554..5b1384357 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -457,6 +457,11 @@ static void get_index(char *buffer, int *i) *i = atoi(buffer); } +static void get_bool(char *buffer, bool *i) +{ + *i = atoi(buffer); +} + static void get_uint8(char *buffer, uint8_t *i) { *i = atoi(buffer); @@ -610,10 +615,10 @@ static void eventtime(char *buffer, duration_t *duration) static void try_to_match_autogroup(const char *name, char *buf) { - int autogroupvalue; + bool autogroupvalue; start_match("autogroup", name, buf); - if (MATCH("state.autogroup", get_index, &autogroupvalue)) { + if (MATCH("state.autogroup", get_bool, &autogroupvalue)) { set_autogroup(autogroupvalue); return; } -- cgit v1.2.3-70-g09d2