[Mesa-dev] [PATCH] i965: Simplify foreach_inst_in_block_safe() macro.

Matt Turner mattst88 at gmail.com
Mon Jun 27 18:27:23 UTC 2016


We know what the end looks like without examining .tail: it's NULL. It's
always NULL.
---
 src/mesa/drivers/dri/i965/brw_cfg.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 5b770aa..1c90eab 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -334,9 +334,8 @@ struct cfg_t {
 
 #define foreach_inst_in_block_safe(__type, __inst, __block)    \
    for (__type *__inst = (__type *)__block->instructions.head, \
-               *__next = (__type *)__inst->next,               \
-               *__end = (__type *)__block->instructions.tail;  \
-        __next != __end;                                       \
+               *__next = (__type *)__inst->next;               \
+        __next != NULL;                                        \
         __inst = __next,                                       \
         __next = (__type *)__next->next)
 
-- 
2.7.3



More information about the mesa-dev mailing list