[PATCH wayland] wayland-server: Add a wl_resource_for_each_safe macro
Kristian Høgsberg
hoegsberg at gmail.com
Wed Sep 11 12:05:50 PDT 2013
On Fri, Sep 06, 2013 at 05:56:27PM +0100, Rob Bradford wrote:
> From: Rob Bradford <rob at linux.intel.com>
>
> A version of wl_resource_for_each that is safe for iteration when items
> in the list are removed.
Looks good, committed.
Kristian
> ---
> src/wayland-server.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/wayland-server.h b/src/wayland-server.h
> index d77050d..c0365c0 100644
> --- a/src/wayland-server.h
> +++ b/src/wayland-server.h
> @@ -313,6 +313,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 *
> --
> 1.8.3.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list