1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

tree-wide: use empty-to-root a bit more

This commit is contained in:
Lennart Poettering 2019-07-16 12:08:47 +02:00
parent 0e3cb57dae
commit 9228fef0d6
2 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,11 @@
@@
expression s;
@@
- if (empty_or_root(s))
- s = "/";
+ s = empty_to_root(s);
@@
expression s;
@@
- (empty_or_root(s) ? "/" : s)
+ empty_to_root(s)

View File

@ -31,8 +31,7 @@ static int add_cgroup(Hashmap *cgroups, const char *path, bool is_const, struct
assert(cgroups);
assert(ret);
if (empty_or_root(path))
path = "/";
path = empty_to_root(path);
cg = hashmap_get(cgroups, path);
if (cg) {
@ -150,8 +149,7 @@ static int dump_processes(
assert(prefix);
if (empty_or_root(cgroup_path))
cgroup_path = "/";
cgroup_path = empty_to_root(cgroup_path);
cg = hashmap_get(cgroups, cgroup_path);
if (!cg)