diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-05-04 15:12:22 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-05-04 15:15:34 +0100 |
commit | f91995f19373b2bba78703310691e1ad68ee1eec (patch) | |
tree | e0455d1fd2bc52bfe7aa50caae95f0b38d1d2e2a /src/include/ipxe | |
parent | 69fa29029c59ede576eda895fc208f88873a9d03 (diff) | |
download | ipxe-f91995f19373b2bba78703310691e1ad68ee1eec.zip ipxe-f91995f19373b2bba78703310691e1ad68ee1eec.tar.gz ipxe-f91995f19373b2bba78703310691e1ad68ee1eec.tar.bz2 |
[list] Add list_for_each_entry_continue() and _continue_reverse()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r-- | src/include/ipxe/list.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h index 231383d..4daf12b 100644 --- a/src/include/ipxe/list.h +++ b/src/include/ipxe/list.h @@ -379,6 +379,32 @@ static inline void list_splice_tail_init ( struct list_head *list, tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) ) /** + * Iterate over entries in a list, starting after current position + * + * @v pos Iterator + * @v head List head + * @v member Name of list field within iterator's type + */ +#define list_for_each_entry_continue( pos, head, member ) \ + for ( list_check ( (head) ), \ + pos = list_entry ( pos->member.next, typeof ( *pos ), member ); \ + &pos->member != (head); \ + pos = list_entry ( pos->member.next, typeof ( *pos ), member ) ) + +/** + * Iterate over entries in a list in reverse, starting after current position + * + * @v pos Iterator + * @v head List head + * @v member Name of list field within iterator's type + */ +#define list_for_each_entry_continue_reverse( pos, head, member ) \ + for ( list_check ( (head) ), \ + pos = list_entry ( pos->member.prev, typeof ( *pos ), member ); \ + &pos->member != (head); \ + pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) ) + +/** * Test if list contains a specified entry * * @v entry Entry |