systemctl: inline iterator declarations

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-14 11:55:56 +01:00
parent e602abba15
commit 76e5e267fc
+8 -20
View File
@@ -492,14 +492,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
case ARG_VERSION:
return version();
case 't': {
const char *p;
case 't':
if (isempty(optarg))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--type= requires arguments.");
for (p = optarg;;) {
for (const char *p = optarg;;) {
_cleanup_free_ char *type = NULL;
r = extract_first_word(&p, &type, ",", 0);
@@ -533,7 +531,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
}
break;
}
case 'P':
arg_value = true;
@@ -546,10 +543,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_properties = new0(char*, 1);
if (!arg_properties)
return log_oom();
} else {
const char *p;
for (p = optarg;;) {
} else
for (const char *p = optarg;;) {
_cleanup_free_ char *prop = NULL;
r = extract_first_word(&p, &prop, ",", 0);
@@ -561,7 +556,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
if (strv_consume(&arg_properties, TAKE_PTR(prop)) < 0)
return log_oom();
}
}
/* If the user asked for a particular property, show it, even if it is empty. */
arg_all = true;
@@ -778,14 +772,12 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_boot_loader_entry = empty_to_null(optarg);
break;
case ARG_STATE: {
const char *p;
case ARG_STATE:
if (isempty(optarg))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--state= requires arguments.");
for (p = optarg;;) {
for (const char *p = optarg;;) {
_cleanup_free_ char *s = NULL;
r = extract_first_word(&p, &s, ",", 0);
@@ -803,7 +795,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
return log_oom();
}
break;
}
case 'r':
if (geteuid() != 0)
@@ -843,13 +834,11 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_with_dependencies = true;
break;
case ARG_WHAT: {
const char *p;
case ARG_WHAT:
if (isempty(optarg))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--what= requires arguments.");
for (p = optarg;;) {
for (const char *p = optarg;;) {
_cleanup_free_ char *k = NULL;
r = extract_first_word(&p, &k, ",", 0);
@@ -873,7 +862,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
}
break;
}
case ARG_REBOOT_ARG:
arg_reboot_argument = optarg;