[Mesa-dev] [PATCH 10/13] util/list: Add a list validation function

Neil Roberts neil at linux.intel.com
Tue May 5 11:25:10 PDT 2015


Jason Ekstrand <jason at jlekstrand.net> writes:

> +static inline void list_validate(struct list_head *list)
> +{
> +   assert(list->next->prev == list && list->prev->next == list);
> +   for (struct list_head *node = list->next; node != list; node = node->next)
> +      assert(node->next->prev == node && node->prev->next == node);
> +}

It would be good if this #included assert.h. It might be nice to use one of
the iterator macros too, although I guess that's just bikeshedding so
I won't complain either way.

Regards,
- Neil


More information about the mesa-dev mailing list