Skip to contentSkip to conversation

urcu: add cds_list_for_each_entry_safe_from macro

PATCH Mathieu Desnoyers 1 participant 1 message May 8, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

----- Original Message -----

Quoted 2 lines

Same as cds_list_for_each_entry_safe, but starts at an arbitrary point within the list instead of at the head.

Merged in urcu master branch, thanks!

Mathieu

Quoted 38 lines
---
 urcu/list.h | 9 +++++++++
 1 file changed, 9 insertions(+)
urcu/list.h +9 -0
index b4962b445dfb..4aaf869351fe 100644
@@ -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)
{
--
2.1.0

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com