summaryrefslogtreecommitdiffstats
path: root/core/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-01-04 15:47:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-01-04 08:21:43 -0800
commit5960718075f5941436629ebfaced3997fe83036b (patch)
tree217b918297fcb502c250c06a70f1a449b1de3aca /core/parse-xml.c
parent40fa148548f001ce8a4a1fa250b31b618f8b50d4 (diff)
downloadsubsurface-5960718075f5941436629ebfaced3997fe83036b.tar.gz
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" <neolit123@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/parse-xml.c')
-rw-r--r--core/parse-xml.c9
1 files changed, 7 insertions, 2 deletions
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;
}