diff options
-rw-r--r-- | src/util/list.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/list.h b/src/util/list.h index 8a18c4b0d8d..17800e4ed4e 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -246,4 +246,11 @@ static inline void list_validate(const struct list_head *list) &pos->member != (head); \ pos = LIST_ENTRY(type, pos->member.prev, member)) +#define list_pair_for_each_entry(type, pos1, pos2, head1, head2, member) \ + for (type *pos1 = LIST_ENTRY(type, (head1)->next, member), \ + *pos2 = LIST_ENTRY(type, (head2)->next, member); \ + &pos1->member != (head1) && &pos2->member != (head2); \ + pos1 = LIST_ENTRY(type, pos1->member.next, member), \ + pos2 = LIST_ENTRY(type, pos2->member.next, member)) + #endif /*_UTIL_LIST_H_*/ |