Mesa (master): glsl: Fix the foreach_in_list_reverse macro.
Kenneth Graunke
kwg at kemper.freedesktop.org
Tue Jul 8 19:29:42 UTC 2014
Module: Mesa
Branch: master
Commit: e13a6406c3d55162d6f4641f3ccca7635b9a5212
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e13a6406c3d55162d6f4641f3ccca7635b9a5212
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sat Jul 5 22:04:45 2014 -0700
glsl: Fix the foreach_in_list_reverse macro.
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 at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/glsl/list.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/glsl/list.h b/src/glsl/list.h
index 922bd68..a4444bd 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -565,9 +565,9 @@ inline void exec_node::insert_before(exec_list *before)
!(__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)
/**
More information about the mesa-commit
mailing list