Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jlayton@poochiereds.net (Jeff Layton)
Subject: [lttng-dev] [PATCH urcu] urcu: add cds_list_for_each_entry_safe_from macro
Date: Thu, 30 Apr 2015 07:50:05 -0400	[thread overview]
Message-ID: <1430394605-27519-1-git-send-email-jeff.layton@primarydata.com> (raw)

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 at primarydata.com>
---
 urcu/list.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/urcu/list.h b/urcu/list.h
index b4962b445dfb..4aaf869351fe 100644
--- a/urcu/list.h
+++ b/urcu/list.h
@@ -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




                 reply	other threads:[~2015-04-30 11:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430394605-27519-1-git-send-email-jeff.layton@primarydata.com \
    --to=jlayton@poochiereds.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox