mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
glsl: Add typed foreach_in_list_safe macro.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
3597681040
commit
da9f0316e6
1 changed files with 9 additions and 0 deletions
|
|
@ -583,6 +583,15 @@ inline void exec_node::insert_before(exec_list *before)
|
|||
!(__inst)->is_head_sentinel(); \
|
||||
(__inst) = (__type *)(__inst)->prev)
|
||||
|
||||
/**
|
||||
* This version is safe even if the current node is removed.
|
||||
*/
|
||||
#define foreach_in_list_safe(__type, __node, __list) \
|
||||
for (__type *__node = (__type *)(__list)->head, \
|
||||
*__next = (__type *)__node->next; \
|
||||
__next != NULL; \
|
||||
__node = __next, __next = (__type *)__next->next)
|
||||
|
||||
/**
|
||||
* Iterate through two lists at once. Stops at the end of the shorter list.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue