We clearly don't want to start at the head and walk backwards; we want
to start at the last real element before the tail sentinel. If the list
is empty, tail_pred will be the head sentinel, and we'll stop.
Nothing uses this function, so I guess nobody noticed it was broken.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
!(__inst)->is_tail_sentinel(); \
(__inst) = (__type *)(__inst)->next)
-#define foreach_in_list_reverse(__type, __inst, __list) \
- for (__type *(__inst) = (__type *)(__list)->head; \
- !(__inst)->is_head_sentinel(); \
+#define foreach_in_list_reverse(__type, __inst, __list) \
+ for (__type *(__inst) = (__type *)(__list)->tail_pred; \
+ !(__inst)->is_head_sentinel(); \
(__inst) = (__type *)(__inst)->prev)
/**