urcu: add cds_list_for_each_entry_safe_from macro
authorJeff Layton <jlayton@poochiereds.net>
Thu, 30 Apr 2015 11:50:05 +0000 (07:50 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 8 May 2015 20:21:15 +0000 (16:21 -0400)
Same as cds_list_for_each_entry_safe, but starts at an arbitrary point
within the list instead of at the head.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/list.h

index b4962b445dfbc766ee229923b0af97f0f16beadf..4aaf869351fea0a8644f696ed294482de6a179d8 100644 (file)
@@ -171,6 +171,15 @@ void cds_list_splice(struct cds_list_head *add, struct cds_list_head *head)
                &pos->member != (head); \
                pos = p, p = cds_list_entry(pos->member.next, __typeof__(*pos), member))
 
+/*
+ * Same as cds_list_for_each_entry_safe, but starts from "pos" which should
+ * point to an entry within the list.
+ */
+#define cds_list_for_each_entry_safe_from(pos, p, head, member) \
+        for (p = cds_list_entry(pos->member.next, __typeof__(*pos), member); \
+                &pos->member != (head); \
+                pos = p, p = cds_list_entry(pos->member.next, __typeof__(*pos), member))
+
 static inline
 int cds_list_empty(struct cds_list_head *head)
 {
This page took 0.025964 seconds and 4 git commands to generate.