Patchwork [2/8] petitboot: Add list_continue_each_entry routine

login
register
mail settings
Submitter Geoff Levand
Date Feb. 16, 2009, 6:57 a.m.
Message ID <20090216065712.752142589@am.sony.com>
Download mbox | patch
Permalink /patch/23204/
State Accepted
Delegated to: Jeremy Kerr
Headers show

Comments

Geoff Levand - Feb. 16, 2009, 6:57 a.m.
Add a new list iteration routine list_continue_each_entry().  Continues
iteration from a user specified list item.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 lib/list/list.h |    4 ++++
 1 file changed, 4 insertions(+)
Jeremy Kerr - Feb. 21, 2009, 3:13 a.m.
Hi Geoff,

> +#define list_continue_each_entry(_list, _pos, _member) \
> +	for (; &_pos->_member != &(_list)->head; \
> +		_pos = list_entry(_pos->_member.next, typeof(*_pos), _member))
> +

Let's make this consistent and use list_for_each_entry_continue.

Cheers,


Jeremy

Patch

--- a/lib/list/list.h
+++ b/lib/list/list.h
@@ -30,6 +30,10 @@  struct list {
 	     &pos->member != &(list)->head; 	\
 	     pos = list_entry(pos->member.next, typeof(*pos), member))
 
+#define list_continue_each_entry(_list, _pos, _member) \
+	for (; &_pos->_member != &(_list)->head; \
+		_pos = list_entry(_pos->_member.next, typeof(*_pos), _member))
+
 void list_init(struct list *list);
 void list_insert_before(struct list_item *next, struct list_item *new);
 void list_insert_after(struct list_item *prev, struct list_item *new);