diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-11 23:20:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-11 23:20:54 +0200 |
commit | 92e189e57297b110a1a12703aa17557e3600cf4f (patch) | |
tree | 602945bacbc479afeb7f9b8d21728da074c82a8d /src/libsystemd-bus/bus-internal.h | |
parent | 8e4e652b92c8c2f640f8ac1c839dd4a0fd11f3c4 (diff) |
bus: unify code to find parents of an object path with
Diffstat (limited to 'src/libsystemd-bus/bus-internal.h')
-rw-r--r-- | src/libsystemd-bus/bus-internal.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h index 5795f74693..6499d6b013 100644 --- a/src/libsystemd-bus/bus-internal.h +++ b/src/libsystemd-bus/bus-internal.h @@ -289,3 +289,8 @@ int bus_start_running(sd_bus *bus); int bus_next_address(sd_bus *bus); bool bus_pid_changed(sd_bus *bus); + +#define OBJECT_PATH_FOREACH_PREFIX(prefix, path) \ + for (char *_slash = ({ strcpy((prefix), (path)); streq((prefix), "/") ? NULL : strrchr((prefix), '/'); }) ; \ + _slash && !(_slash[(_slash) == (prefix)] = 0); \ + _slash = streq((prefix), "/") ? NULL : strrchr((prefix), '/')) |