]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bus-unit-procs: use empty_or_root() where appropriate 11985/head
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Mar 2019 16:44:11 +0000 (17:44 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Mar 2019 16:44:11 +0000 (17:44 +0100)
src/shared/bus-unit-procs.c

index bf71e3b5462a473306ffa760ca26b2f935a67507..23c5a12454ca301ab1f765f3da1b51f3cd73df04 100644 (file)
@@ -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);