summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-bus/bus-internal.h')
-rw-r--r--src/libsystemd-bus/bus-internal.h5
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), '/'))