spa: add spa_atob() to convert a string to a boolean

This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
This commit is contained in:
Peter Hutterer 2021-05-18 15:18:14 +10:00
parent 4e70799922
commit cdfd50e166
18 changed files with 58 additions and 34 deletions

View file

@ -360,7 +360,7 @@ impl_init(const struct spa_handle_factory *factory,
if (info) {
if ((str = spa_dict_lookup(info, "node.freewheel")) != NULL)
this->props.freewheel = (spa_streq(str, "true") || atoi(str) == 1);
this->props.freewheel = spa_atob(str);
}
spa_loop_add_source(this->data_loop, &this->timer_source);