mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 12:34:27 +00:00
core: correctly parse boolean configuration values.
Also, with style.
This commit is contained in:
parent
0e8ec8d060
commit
8dd1c2d4af
@ -1392,18 +1392,20 @@ static char *parse_config(json_t *config, bool fileconf, int parent_iteration)
|
||||
int n, size = json_array_size(val);
|
||||
|
||||
for (n = 0; n < size && !err; n++) {
|
||||
if (json_is_string(json_array_get(val, n)))
|
||||
if (json_is_string(json_array_get(val, n))) {
|
||||
err = opt->cb_arg(json_string_value(json_array_get(val, n)), opt->u.arg);
|
||||
}
|
||||
else if (json_is_object(json_array_get(val, n)))
|
||||
{
|
||||
err = parse_config(json_array_get(val, n), false, n);
|
||||
json_array_index = parent_iteration;
|
||||
}
|
||||
}
|
||||
} else if ((opt->type & OPT_NOARG) && json_is_true(val))
|
||||
} else if ((opt->type & OPT_NOARG) && json_is_boolean(val)) {
|
||||
err = opt->cb(opt->u.arg);
|
||||
else
|
||||
} else {
|
||||
err = "Invalid value";
|
||||
}
|
||||
|
||||
if (err) {
|
||||
/* Allow invalid values to be in configuration
|
||||
|
Loading…
x
Reference in New Issue
Block a user