diff options
Diffstat (limited to 'src/glsl/list.h')
-rw-r--r-- | src/glsl/list.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/glsl/list.h b/src/glsl/list.h index 29997c78ee..7348e323c1 100644 --- a/src/glsl/list.h +++ b/src/glsl/list.h @@ -433,18 +433,12 @@ struct exec_list { }; /** - * This version is safe even if the current node is removed. If you insert - * new nodes before the current node, they will be processed next. - * - * \note - * The extra test for \c __node being \c NULL is required because after the - * iteration \c __prev coupld be the last node in the list. The loop increment - * then causes \c __prev to point to the sentinal and \c __node to be \c NULL. + * This version is safe even if the current node is removed. */ -#define foreach_list_safe(__node, __list) \ - for (exec_node * __prev = (exec_node *) (__list), * __node = (__list)->head \ - ; __node != NULL && (__node)->next != NULL \ - ; __prev = (__prev)->next, __node = (__prev)->next) +#define foreach_list_safe(__node, __list) \ + for (exec_node * __node = (__list)->head, * __next = __node->next \ + ; __next != NULL \ + ; __node = __next, __next = __next->next) #define foreach_list(__node, __list) \ for (exec_node * __node = (__list)->head \ |