Patchwork [02/16] petitboot: Add list_for_each_entry_continue routine

login
register
mail settings
Submitter Geoff Levand
Date Feb. 28, 2009, 12:53 a.m.
Message ID <20090228005350.334406316@am.sony.com>
Download mbox | patch
Permalink /patch/23848/
State Accepted
Headers show

Comments

Geoff Levand - Feb. 28, 2009, 12:53 a.m.
Add a new list iteration routine list_for_each_entry_continue().  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(+)

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_for_each_entry_continue(_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);