diff options
author | Jason Ekstrand <[email protected]> | 2019-08-05 16:19:06 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-13 23:36:44 +0000 |
commit | aeb95fda541719d5fe9b8fdb531f3370228228d7 (patch) | |
tree | a503ff34af7df9514a50e85ac3998f82c0e01cce /src/util | |
parent | 5425968d2e46eb3311a75f4bf7bedb1d9dd59459 (diff) |
util/list: Add a list pair iterator
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5019>
Diffstat (limited to 'src/util')
-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_*/ |