From 748c20c46f6c85203dc5582c9e7fce9fee7a1331 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 22 Jul 2013 17:30:51 +0100 Subject: [PATCH] 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. --- src/wayland-server.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wayland-server.h b/src/wayland-server.h index de389eaf..e5e0ed8b 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 *