[PATCH 1/3] wayland-utils: add wl_list_for_each_reverse_safe macro.
zhiwen.wu at linux.intel.com
zhiwen.wu at linux.intel.com
Sun Apr 1 05:13:07 PDT 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
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