[PATCH 1/3] wayland-utils: add wl_list_for_each_reverse_safe macro.

Kristian Høgsberg krh at bitplanet.net
Tue Apr 3 07:50:26 PDT 2012


On Sun, Apr 1, 2012 at 8:13 AM,  <zhiwen.wu at linux.intel.com> wrote:
> From: Alex Wu <zhiwen.wu at linux.intel.com>

These three look good, all merged.

Kristian

> Add the safe version for wl_list_for_each_reverse
> ---
>  src/wayland-util.h |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/src/wayland-util.h b/src/wayland-util.h
> index d9e13e6..642a04b 100644
> --- a/src/wayland-util.h
> +++ b/src/wayland-util.h
> @@ -140,6 +140,14 @@ void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
>             &pos->member != (head);                                    \
>             pos = __wl_container_of(pos->member.prev, pos, member))
>
> +#define wl_list_for_each_reverse_safe(pos, tmp, head, member)          \
> +       for (pos = 0, tmp = 0,                                          \
> +            pos = __wl_container_of((head)->prev, pos, member),        \
> +            tmp = __wl_container_of((pos)->member.prev, tmp, member);  \
> +            &pos->member != (head);                                    \
> +            pos = tmp,                                                 \
> +            tmp = __wl_container_of(pos->member.prev, tmp, member))
> +
>  struct wl_array {
>        size_t size;
>        size_t alloc;
> --
> 1.7.5.4
>


More information about the wayland-devel mailing list