option-parser: Make bools boolean

When option-parser is confronted with a boolean option, have it write a
bool rather than treating the value as a pointer to an int32.

(lib)weston already heavily uses bool types internally, so this has the
nice side effect of eliminating quite a few local variables which only
existed as integer shadows of internal boolean variables.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone
2019-11-26 00:32:22 +00:00
committed by Daniel Stone
parent b8c3926445
commit dd8219b3fb
9 changed files with 51 additions and 86 deletions
+2 -2
View File
@@ -76,7 +76,7 @@ long_option(const struct weston_option *options, int count, char *arg)
if (options[k].type == WESTON_OPTION_BOOLEAN) {
if (!arg[len + 2]) {
* (int32_t *) options[k].data = 1;
* (bool *) options[k].data = true;
return true;
}
@@ -127,7 +127,7 @@ short_option(const struct weston_option *options, int count, char *arg)
if (options[k].type == WESTON_OPTION_BOOLEAN) {
if (!arg[2]) {
* (int32_t *) options[k].data = 1;
* (bool *) options[k].data = true;
return true;
}