diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-05-01 13:15:00 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2010-05-11 11:01:35 -0400 |
commit | 32381363cd8f43aeb741bad70bcf96a287dac0c9 (patch) | |
tree | 6aea9fde44bb85740b5179557e6a30ba364a2428 | |
parent | 4a8a615d01b9ed18c272414bd11dc2fc661727e5 (diff) |
list.h: Add list_for_each_entry_safe()
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | include/list.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/list.h b/include/list.h index a126a652d..89dc29dd0 100644 --- a/include/list.h +++ b/include/list.h @@ -94,4 +94,10 @@ list_is_empty(struct list *head) &pos->member != (head); \ pos = __container_of(pos->member.next, pos, member)) +#define list_for_each_entry_safe(pos, next, head, member) \ + for (pos = __container_of((head)->next, pos, member), \ + next = __container_of(pos->member.next, pos, member); \ + &pos->member != (head); \ + pos = next, next = __container_of(next->member.next, next, member)) + #endif |