[Mesa-dev] [PATCH 065/133] glsl/list: Add a foreach_list_typed_safe_reverse macro

Connor Abbott cwabbott0 at gmail.com
Tue Dec 16 14:48:29 PST 2014


On Tue, Dec 16, 2014 at 1:05 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> ---
>  src/glsl/list.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/glsl/list.h b/src/glsl/list.h
> index 4774ccc..330c17e 100644
> --- a/src/glsl/list.h
> +++ b/src/glsl/list.h
> @@ -678,4 +678,13 @@ inline void exec_node::insert_before(exec_list *before)
>          __node = __next, __next =                                          \
>             exec_node_data(__type, (__next)->__field.next, __field))
>
> +#define foreach_list_typed_safe_reverse(__type, __node, __field, __list)   \
> +   for (__type * __node =                                                  \
> +           exec_node_data(__type, (__list)->tail_pred, __field),           \
> +               * __prev =                                                  \
> +           exec_node_data(__type, (__node)->__field.prev, __field);        \
> +        __prev != NULL;                                                    \
> +        __node = __prev, __prev =                                          \
> +           exec_node_data(__type, (__prev)->__field.prev, __field))
> +
>  #endif /* LIST_CONTAINER_H */
> --
> 2.2.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>


More information about the mesa-dev mailing list