summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2013-07-22 17:30:51 +0100
committerKristian Høgsberg <krh@bitplanet.net>2013-08-12 16:26:36 -0700
commit748c20c46f6c85203dc5582c9e7fce9fee7a1331 (patch)
tree141b49c3617140c3be1d49725b3349cbe30fbe36
parentdbc41f0344ab26fda9cc4565531b81536f8b9493 (diff)
wayland-server: Add a wl_resource_for_each macro
This macro allows you to correctly iterate through a list of resources handling the opaque nature of this type.
-rw-r--r--src/wayland-server.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wayland-server.h b/src/wayland-server.h
index de389ea..e5e0ed8 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -298,6 +298,11 @@ struct wl_listener *
wl_resource_get_destroy_listener(struct wl_resource *resource,
wl_notify_func_t notify);
+#define wl_resource_for_each(resource, list) \
+ for (resource = 0, resource = wl_resource_from_link((list)->next); \
+ wl_resource_get_link(resource) != (list); \
+ resource = wl_resource_from_link(wl_resource_get_link(resource)->next))
+
struct wl_shm_buffer;
struct wl_shm_buffer *