From: Zbigniew Jędrzejewski-Szmek Date: Sun, 14 Feb 2021 10:50:08 +0000 (+0100) Subject: systemctl: inline iterator declarations X-Git-Tag: v248-rc1~127^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76e5e267fcf4d5c8d1470769b97ad75a7c67394b;p=thirdparty%2Fsystemd.git systemctl: inline iterator declarations --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 16d0555c7ca..97a02ff035e 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -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;