[PATCH 3/4] list.h: Add list_for_each_entry_safe()
Kristian Høgsberg
krh at bitplanet.net
Sat May 1 10:31:59 PDT 2010
Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
---
include/list.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/list.h b/include/list.h
index a126a65..89dc29d 100644
--- a/include/list.h
+++ b/include/list.h
@@ -94,4 +94,10 @@ list_is_empty(struct list *head)
&pos->member != (head); \
pos = __container_of(pos->member.next, pos, member))
+#define list_for_each_entry_safe(pos, next, head, member) \
+ for (pos = __container_of((head)->next, pos, member), \
+ next = __container_of(pos->member.next, pos, member); \
+ &pos->member != (head); \
+ pos = next, next = __container_of(next->member.next, next, member))
+
#endif
--
1.7.0.1
More information about the xorg-devel
mailing list