summaryrefslogtreecommitdiff
path: root/src/wayland-server.h
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2013-09-06 17:56:27 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-09-11 12:03:22 -0700
commit656f3ea5b34cbaac3c00576226098279f953cee7 (patch)
tree4dbeed7292f095a0f65dc76992a11f4e85096e44 /src/wayland-server.h
parenta27b7304905bd5dc1aecd5afd8259a834e3da175 (diff)
wayland-server: Add a wl_resource_for_each_safe macro
A version of wl_resource_for_each that is safe for iteration when items in the list are removed.
Diffstat (limited to 'src/wayland-server.h')
-rw-r--r--src/wayland-server.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wayland-server.h b/src/wayland-server.h
index 7404c3b..67f3bdd 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -350,6 +350,14 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
wl_resource_get_link(resource) != (list); \
resource = wl_resource_from_link(wl_resource_get_link(resource)->next))
+#define wl_resource_for_each_safe(resource, tmp, list) \
+ for (resource = 0, tmp = 0, \
+ resource = wl_resource_from_link((list)->next), \
+ tmp = wl_resource_from_link((list)->next->next); \
+ wl_resource_get_link(resource) != (list); \
+ resource = tmp, \
+ tmp = wl_resource_from_link(wl_resource_get_link(resource)->next))
+
struct wl_shm_buffer;
struct wl_shm_buffer *