From 1b63cc6ea932edd1f93c3d2a78c9e34b1c7e52f0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 13 Mar 2019 17:44:11 +0100 Subject: [PATCH] bus-unit-procs: use empty_or_root() where appropriate --- src/shared/bus-unit-procs.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c index bf71e3b5462..23c5a12454c 100644 --- a/src/shared/bus-unit-procs.c +++ b/src/shared/bus-unit-procs.c @@ -5,6 +5,7 @@ #include "list.h" #include "locale-util.h" #include "macro.h" +#include "path-util.h" #include "process-util.h" #include "sort-util.h" #include "string-util.h" @@ -23,10 +24,6 @@ struct CGroupInfo { size_t n_children; }; -static bool IS_ROOT(const char *p) { - return isempty(p) || streq(p, "/"); -} - static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct CGroupInfo **ret) { struct CGroupInfo *parent = NULL, *cg; int r; @@ -34,7 +31,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct assert(cgroups); assert(ret); - if (IS_ROOT(path)) + if (empty_or_root(path)) path = "/"; cg = hashmap_get(cgroups, path); @@ -43,7 +40,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct return 0; } - if (!IS_ROOT(path)) { + if (!empty_or_root(path)) { const char *e, *pp; e = strrchr(path, '/'); @@ -153,7 +150,7 @@ static int dump_processes( assert(prefix); - if (IS_ROOT(cgroup_path)) + if (empty_or_root(cgroup_path)) cgroup_path = "/"; cg = hashmap_get(cgroups, cgroup_path); -- 2.47.3