From 656f3ea5b34cbaac3c00576226098279f953cee7 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 6 Sep 2013 17:56:27 +0100 Subject: 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. --- src/wayland-server.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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 * -- cgit v1.2.3