diff options
author | Alex Wu <zhiwen.wu@linux.intel.com> | 2012-04-01 20:13:07 +0800 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-04-02 22:12:56 -0400 |
commit | 68cf7a1a425c986304ae179a58279d43210e790f (patch) | |
tree | 6160cb35d3d89daa2bd672d04cef5df3fa5d6542 | |
parent | 3cddb3c692acd3536a7cc8542a29f0cc3c0ac3d6 (diff) |
wayland-utils: add wl_list_for_each_reverse_safe macro.
Add the safe version for wl_list_for_each_reverse
-rw-r--r-- | 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; |