From 92e189e57297b110a1a12703aa17557e3600cf4f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 11 Oct 2013 23:20:54 +0200 Subject: bus: unify code to find parents of an object path with --- src/libsystemd-bus/bus-internal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libsystemd-bus/bus-internal.h') 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), '/')) -- cgit v1.2.3-54-g00ecf