summaryrefslogtreecommitdiff
path: root/src/analyze
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-20 14:21:37 +0100
committerSusant Sahani <ssahani@vmware.com>2021-01-20 15:13:24 +0100
commita67f102e79d9bbec9477ac1d50eaf92427a3524a (patch)
tree2913aafe56cd07b50cb63fc7690e9fc9e6f25e39 /src/analyze
parentc2484a75145b6264a5c3f3e07aab8736f21d36e1 (diff)
downloadsystemd-a67f102e79d9bbec9477ac1d50eaf92427a3524a.tar.gz
analyze: tighten variable scope used in loop
Diffstat (limited to 'src/analyze')
-rw-r--r--src/analyze/analyze.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 9920f2a856..a45cc00853 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1022,7 +1022,6 @@ static int list_dependencies(sd_bus *bus, const char *name) {
static int analyze_critical_chain(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(unit_times_freep) struct unit_times *times = NULL;
- struct unit_times *u;
Hashmap *h;
int n, r;
@@ -1038,7 +1037,7 @@ static int analyze_critical_chain(int argc, char *argv[], void *userdata) {
if (!h)
return log_oom();
- for (u = times; u->has_data; u++) {
+ for (struct unit_times *u = times; u->has_data; u++) {
r = hashmap_put(h, u->name, u);
if (r < 0)
return log_error_errno(r, "Failed to add entry to hashmap: %m");
@@ -1065,7 +1064,6 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(unit_times_freep) struct unit_times *times = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
- struct unit_times *u;
TableCell *cell;
int n, r;
@@ -1105,7 +1103,7 @@ static int analyze_blame(int argc, char *argv[], void *userdata) {
if (r < 0)
return r;
- for (u = times; u->has_data; u++) {
+ for (struct unit_times *u = times; u->has_data; u++) {
if (u->time <= 0)
continue;