diff options
author | John Anthony <johnanthony@lavabit.com> | 2013-06-16 01:18:03 +0100 |
---|---|---|
committer | John Anthony <johnanthony@lavabit.com> | 2013-06-16 01:18:03 +0100 |
commit | 4fe5bbb2df856cdc83a13648e943c27f44c71e48 (patch) | |
tree | a90728404ddef7d4bd625156d71153d5bc74a69f /list.h | |
parent | b0485d66a69701cbc7d3a5316142ee599ef3db19 (diff) | |
download | nyancat-4fe5bbb2df856cdc83a13648e943c27f44c71e48.tar.gz nyancat-4fe5bbb2df856cdc83a13648e943c27f44c71e48.tar.bz2 nyancat-4fe5bbb2df856cdc83a13648e943c27f44c71e48.zip |
Newer version of generic list
Diffstat (limited to 'list.h')
-rw-r--r-- | list.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -215,6 +215,16 @@ list_splice_init(struct list_head *list, struct list_head *head) { pos = n, n = pos->next) /** + * list_for_each_safe_reverse - iterate list backwards safely + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe_reverse(pos, n, head) \ + for (pos = (head)->prev, n = pos->prev; pos != (head); \ + pos = n, n = pos->prev) + +/** * list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop counter. * @head: the head for your list. @@ -226,6 +236,17 @@ list_splice_init(struct list_head *list, struct list_head *head) { pos = list_entry(pos->member.next, typeof(*pos), member)) /** + * list_for_each_entry_reverse - iterate list of given type backwards + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** * list_for_each_entry_safe - iterate list entries safe against removal * @pos: the type * to use as a loop counter. * @n: another type * to use as temporary storage |