mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
40fa148548
commit
5960718075
1 changed files with 7 additions and 2 deletions
|
@ -457,6 +457,11 @@ static void get_index(char *buffer, int *i)
|
||||||
*i = atoi(buffer);
|
*i = atoi(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void get_bool(char *buffer, bool *i)
|
||||||
|
{
|
||||||
|
*i = atoi(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
static void get_uint8(char *buffer, uint8_t *i)
|
static void get_uint8(char *buffer, uint8_t *i)
|
||||||
{
|
{
|
||||||
*i = atoi(buffer);
|
*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)
|
static void try_to_match_autogroup(const char *name, char *buf)
|
||||||
{
|
{
|
||||||
int autogroupvalue;
|
bool autogroupvalue;
|
||||||
|
|
||||||
start_match("autogroup", name, buf);
|
start_match("autogroup", name, buf);
|
||||||
if (MATCH("state.autogroup", get_index, &autogroupvalue)) {
|
if (MATCH("state.autogroup", get_bool, &autogroupvalue)) {
|
||||||
set_autogroup(autogroupvalue);
|
set_autogroup(autogroupvalue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue