[Mesa-dev] [PATCH 02/16] glsl: Add a foreach_in_list_reverse_safe macro.

Connor Abbott cwabbott0 at gmail.com
Tue Jan 20 06:16:14 PST 2015


Shouldn't the subject say "exec_list: Add a
foreach_in_list_reverse_safe macro."?

On Mon, Jan 19, 2015 at 6:31 PM, Matt Turner <mattst88 at gmail.com> wrote:
> ---
>  src/glsl/list.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/glsl/list.h b/src/glsl/list.h
> index 330c17e..85368a4 100644
> --- a/src/glsl/list.h
> +++ b/src/glsl/list.h
> @@ -636,6 +636,12 @@ inline void exec_node::insert_before(exec_list *before)
>          __next != NULL;                              \
>          __node = __next, __next = (__type *)__next->next)
>
> +#define foreach_in_list_reverse_safe(__type, __node, __list) \
> +   for (__type *__node = (__type *)(__list)->tail_pred,      \
> +               *__prev = (__type *)__node->prev;             \
> +        __prev != NULL;                                      \
> +        __node = __prev, __prev = (__type *)__prev->prev)
> +
>  #define foreach_in_list_use_after(__type, __inst, __list) \
>     __type *(__inst);                                      \
>     for ((__inst) = (__type *)(__list)->head;              \
> --
> 2.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list