config-parser: Make get_bool be bool
Wayland innovated a lot of cool things, but non-binary boolean values is the great advances of our time. Make config_parser_get_bool() work on boolean values, and switch all its users. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
0a4f6e7d6d
commit
51d995ad82
@@ -302,7 +302,7 @@ WL_EXPORT
|
||||
int
|
||||
weston_config_section_get_bool(struct weston_config_section *section,
|
||||
const char *key,
|
||||
int *value, int default_value)
|
||||
bool *value, bool default_value)
|
||||
{
|
||||
struct weston_config_entry *entry;
|
||||
|
||||
@@ -314,9 +314,9 @@ weston_config_section_get_bool(struct weston_config_section *section,
|
||||
}
|
||||
|
||||
if (strcmp(entry->value, "false") == 0)
|
||||
*value = 0;
|
||||
*value = false;
|
||||
else if (strcmp(entry->value, "true") == 0)
|
||||
*value = 1;
|
||||
*value = true;
|
||||
else {
|
||||
*value = default_value;
|
||||
errno = EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user