include: Avoid using a field reference as a truth value.

Ported from 5d01ebab89cee8a3499ee00729c048068d5b719d from Wine.

Despite the commit message there, even GCC 11.1 chokes on this.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-12-17 11:48:17 -06:00 committed by Alexandre Julliard
parent c7682480dd
commit d0e539aec9

View File

@ -133,7 +133,7 @@ static inline struct rb_entry *rb_postorder_next(struct rb_entry *iter)
/* iterate through the tree using a tree entry */
#define RB_FOR_EACH_ENTRY(elem, tree, type, field) \
for ((elem) = RB_ENTRY_VALUE(rb_head((tree)->root), type, field); \
&(elem)->field; \
(elem) != RB_ENTRY_VALUE(0, type, field); \
(elem) = RB_ENTRY_VALUE(rb_next(&elem->field), type, field))
/* iterate through the tree using using postorder, making it safe to free the entry */
@ -145,7 +145,7 @@ static inline struct rb_entry *rb_postorder_next(struct rb_entry *iter)
/* iterate through the tree using a tree entry and postorder, making it safe to free the entry */
#define RB_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
for ((elem) = RB_ENTRY_VALUE(rb_postorder_head((tree)->root), type, field); \
&(elem)->field \
(elem) != WINE_RB_ENTRY_VALUE(0, type, field) \
&& (((elem2) = RB_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
(elem) = (elem2))