diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-04-02 21:22:17 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-04-03 15:28:53 +0200 |
commit | 73ed4874e9e65e1c15850752ccb9db611e7c8b77 (patch) | |
tree | 37044b5bd9d1892e22ea0e91123c213963ba3426 /src | |
parent | 68e58ca95bea25a78190b464c24f42705ae287c5 (diff) | |
download | systemd-73ed4874e9e65e1c15850752ccb9db611e7c8b77.tar.gz |
shared/exec-util: reduce scope of iterator variables
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/exec-util.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c index a2e8f428e6..56f16188e1 100644 --- a/src/shared/exec-util.c +++ b/src/shared/exec-util.c @@ -427,14 +427,14 @@ int exec_command_flags_to_strv(ExecCommandFlags flags, char ***ex_opts) { _cleanup_strv_free_ char **ret_opts = NULL; ExecCommandFlags it = flags; const char *str; - int i, r; + int r; assert(ex_opts); if (flags < 0) return flags; - for (i = 0; it != 0; it &= ~(1 << i), i++) { + for (unsigned i = 0; it != 0; it &= ~(1 << i), i++) if (FLAGS_SET(flags, (1 << i))) { str = exec_command_flags_to_string(1 << i); if (!str) @@ -444,7 +444,6 @@ int exec_command_flags_to_strv(ExecCommandFlags flags, char ***ex_opts) { if (r < 0) return r; } - } *ex_opts = TAKE_PTR(ret_opts); @@ -466,9 +465,7 @@ static const char* const exec_command_strings[] = { }; const char* exec_command_flags_to_string(ExecCommandFlags i) { - size_t idx; - - for (idx = 0; idx < ELEMENTSOF(exec_command_strings); idx++) + for (size_t idx = 0; idx < ELEMENTSOF(exec_command_strings); idx++) if (i == (1 << idx)) return exec_command_strings[idx]; |