From 24aaf6c66ce9de6927e534cfeec47aa5830d5a0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 14 Mar 2023 16:52:18 +0100 Subject: [PATCH] core: reduce scope of variable --- src/core/load-fragment.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index fa2f15c2f4e..28d80d605f5 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -202,7 +202,7 @@ bool contains_instance_specifier_superset(const char *s) { return false; /* %i, %n and %N all expand to the instance or a superset of it. */ - for (; p < q; p++) { + for (; p < q; p++) if (*p == '%') percent = !percent; else if (percent) { @@ -210,7 +210,6 @@ bool contains_instance_specifier_superset(const char *s) { return true; percent = false; } - } return false; } @@ -4382,15 +4381,13 @@ int config_parse_io_limit( } if (!l) { - CGroupIOLimitType ttype; - l = new0(CGroupIODeviceLimit, 1); if (!l) return log_oom(); l->path = TAKE_PTR(resolved); - for (ttype = 0; ttype < _CGROUP_IO_LIMIT_TYPE_MAX; ttype++) - l->limits[ttype] = cgroup_io_limit_defaults[ttype]; + for (CGroupIOLimitType i = 0; i < _CGROUP_IO_LIMIT_TYPE_MAX; i++) + l->limits[i] = cgroup_io_limit_defaults[i]; LIST_PREPEND(device_limits, c->io_device_limits, l); } -- 2.47.3