diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-15 20:08:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-16 14:46:49 +0100 |
commit | 63a0cbbac3723c0684807fb39fc37f6c180d4a17 (patch) | |
tree | 5e4debd30f5be379b00e323752a1960d9db692fc /src/cgtop | |
parent | fdaa23af94f0e785036c52d6a603a3e2c1aff81e (diff) | |
download | systemd-63a0cbbac3723c0684807fb39fc37f6c180d4a17.tar.gz systemd-63a0cbbac3723c0684807fb39fc37f6c180d4a17.tar.bz2 systemd-63a0cbbac3723c0684807fb39fc37f6c180d4a17.zip |
cgtop: use FOREACH_STRING() for fun and profit
Diffstat (limited to 'src/cgtop')
-rw-r--r-- | src/cgtop/cgtop.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index cf2de7eb5a..efbfd240a6 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -501,31 +501,14 @@ static int refresh_one( } static int refresh(const char *root, Hashmap *a, Hashmap *b, unsigned iteration) { + const char *c; int r; - assert(a); - - r = refresh_one(SYSTEMD_CGROUP_CONTROLLER, root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("cpu", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("cpuacct", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("memory", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("io", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("blkio", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; - r = refresh_one("pids", root, a, b, iteration, 0, NULL); - if (r < 0) - return r; + FOREACH_STRING(c, SYSTEMD_CGROUP_CONTROLLER, "cpu", "cpuacct", "memory", "io", "blkio", "pids") { + r = refresh_one(c, root, a, b, iteration, 0, NULL); + if (r < 0) + return r; + } return 0; } |