diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-16 14:32:23 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-03-19 00:33:33 +0100 |
commit | de010b0b2e50cf0b3837ce350b116bc92605f67a (patch) | |
tree | 226685fbb97461692562035501ebc21a314f718c /src/analyze/analyze-critical-chain.c | |
parent | list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() safer (diff) | |
download | systemd-de010b0b2e50cf0b3837ce350b116bc92605f67a.tar.xz systemd-de010b0b2e50cf0b3837ce350b116bc92605f67a.zip |
strv: make iterator in STRV_FOREACH() declaread in the loop
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
Diffstat (limited to 'src/analyze/analyze-critical-chain.c')
-rw-r--r-- | src/analyze/analyze-critical-chain.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/analyze/analyze-critical-chain.c b/src/analyze/analyze-critical-chain.c index d3169791d9..3a6b777053 100644 --- a/src/analyze/analyze-critical-chain.c +++ b/src/analyze/analyze-critical-chain.c @@ -76,7 +76,6 @@ static bool times_in_range(const UnitTimes *times, const BootTimes *boot) { static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level, char ***units, unsigned branches) { _cleanup_strv_free_ char **deps = NULL; - char **c; int r; usec_t service_longest = 0; int to_print = 0; @@ -225,11 +224,10 @@ int verb_critical_chain(int argc, char *argv[], void *userdata) { puts("The time when unit became active or started is printed after the \"@\" character.\n" "The time the unit took to start is printed after the \"+\" character.\n"); - if (argc > 1) { - char **name; + if (argc > 1) STRV_FOREACH(name, strv_skip(argv, 1)) list_dependencies(bus, *name); - } else + else list_dependencies(bus, SPECIAL_DEFAULT_TARGET); h = hashmap_free(h); |