diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 10:48:13 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 11:50:18 +0100 |
commit | 5980d463048f25411c55da2f6387cdc8eaeef4c8 (patch) | |
tree | e5c32417015bfd67d326d278b1cd7dac3ada39de /src/home/homectl.c | |
parent | Merge pull request #22629 from nishalkulkarni/oomd_service_result (diff) | |
download | systemd-5980d463048f25411c55da2f6387cdc8eaeef4c8.tar.xz systemd-5980d463048f25411c55da2f6387cdc8eaeef4c8.zip |
strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354.
No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.
I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.
Diffstat (limited to 'src/home/homectl.c')
-rw-r--r-- | src/home/homectl.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/home/homectl.c b/src/home/homectl.c index 671d5f5130..f0d1dac6ab 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -2949,8 +2949,6 @@ static int parse_argv(int argc, char *argv[]) { case ARG_DISK_SIZE: if (isempty(optarg)) { - const char *prop; - FOREACH_STRING(prop, "diskSize", "diskSizeRelative", "rebalanceWeight") { r = drop_from_identity(prop); if (r < 0) @@ -3452,9 +3450,7 @@ static int parse_argv(int argc, char *argv[]) { break; } - case ARG_PKCS11_TOKEN_URI: { - const char *p; - + case ARG_PKCS11_TOKEN_URI: if (streq(optarg, "list")) return pkcs11_list_tokens(); @@ -3488,11 +3484,8 @@ static int parse_argv(int argc, char *argv[]) { strv_uniq(arg_pkcs11_token_uri); break; - } - - case ARG_FIDO2_DEVICE: { - const char *p; + case ARG_FIDO2_DEVICE: if (streq(optarg, "list")) return fido2_list_devices(); @@ -3522,7 +3515,6 @@ static int parse_argv(int argc, char *argv[]) { strv_uniq(arg_fido2_device); break; - } case ARG_FIDO2_WITH_PIN: { bool lock_with_pin; @@ -3557,9 +3549,7 @@ static int parse_argv(int argc, char *argv[]) { break; } - case ARG_RECOVERY_KEY: { - const char *p; - + case ARG_RECOVERY_KEY: r = parse_boolean(optarg); if (r < 0) return log_error_errno(r, "Failed to parse --recovery-key= argument: %s", optarg); @@ -3573,7 +3563,6 @@ static int parse_argv(int argc, char *argv[]) { } break; - } case ARG_AUTO_RESIZE_MODE: if (isempty(optarg)) { |