Add a LIST_FOR_EACH_ENTRY list helper.
This commit is contained in:
parent
c905d691c8
commit
7b3d092c26
|
@ -149,6 +149,12 @@ inline static void list_init( struct list *list )
|
|||
(cursor) != (list); \
|
||||
(cursor) = (cursor2), (cursor2) = (cursor)->next)
|
||||
|
||||
/* iterate through the list using a list entry */
|
||||
#define LIST_FOR_EACH_ENTRY(elem, list, type, field) \
|
||||
for ((elem) = LIST_ENTRY((list)->next, type, field); \
|
||||
&(elem)->field != (list); \
|
||||
(elem) = LIST_ENTRY((elem)->field.next, type, field))
|
||||
|
||||
/* macros for statically initialized lists */
|
||||
#define LIST_INIT(list) { &(list), &(list) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue