tree-wide: use parse_boolean_argument() for variables with non-boolean type
This still works nicely, but we need to assign the return value ourselves. As before, one nice effect is that error messages are uniform.
This commit is contained in:
@@ -20,11 +20,13 @@ int parse_boolean_argument(const char *optname, const char *s, bool *ret) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse boolean argument to %s: %s.", optname, s);
|
||||
|
||||
*ret = r;
|
||||
if (ret)
|
||||
*ret = r;
|
||||
return r;
|
||||
} else {
|
||||
/* s may be NULL. This is controlled by getopt_long() parameters. */
|
||||
*ret = true;
|
||||
if (ret)
|
||||
*ret = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user