tree-wide: make invocations of extract_first_word more uniform (#4627)

extract_first_words deals fine with the string being NULL, so drop the upfront
check for that.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-11-11 18:58:41 +01:00
committed by Lennart Poettering
parent 5f36e3d303
commit c58bd76a6a
7 changed files with 40 additions and 72 deletions
+4 -11
View File
@@ -7214,14 +7214,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
p = optarg;
for (;;) {
for (p = optarg;;) {
_cleanup_free_ char *type = NULL;
r = extract_first_word(&p, &type, ",", 0);
if (r < 0)
return log_error_errno(r, "Failed to parse type: %s", optarg);
if (r == 0)
break;
@@ -7263,15 +7261,13 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_properties = new0(char*, 1);
if (!arg_properties)
return log_oom();
} else {
p = optarg;
for (;;) {
} else
for (p = optarg;;) {
_cleanup_free_ char *prop = NULL;
r = extract_first_word(&p, &prop, ",", 0);
if (r < 0)
return log_error_errno(r, "Failed to parse property: %s", optarg);
if (r == 0)
break;
@@ -7280,7 +7276,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
prop = NULL;
}
}
/* If the user asked for a particular
* property, show it to him, even if it is
@@ -7457,14 +7452,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
p = optarg;
for (;;) {
for (p = optarg;;) {
_cleanup_free_ char *s = NULL;
r = extract_first_word(&p, &s, ",", 0);
if (r < 0)
return log_error_errno(r, "Failed to parse signal: %s", optarg);
if (r == 0)
break;