Alexandre Julliard : rbtree: Clarify the loop conditions to avoid confusing older gcc.

Alexandre Julliard julliard at winehq.org
Wed Oct 25 13:58:43 CDT 2017


Module: wine
Branch: master
Commit: 5d01ebab89cee8a3499ee00729c048068d5b719d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5d01ebab89cee8a3499ee00729c048068d5b719d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 25 18:41:10 2017 +0200

rbtree: Clarify the loop conditions to avoid confusing older gcc.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/rbtree.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/wine/rbtree.h b/include/wine/rbtree.h
index bb4edf5..dc50b5e 100644
--- a/include/wine/rbtree.h
+++ b/include/wine/rbtree.h
@@ -147,7 +147,7 @@ static inline struct wine_rb_entry *wine_rb_postorder_next(struct wine_rb_entry
 /* iterate through the tree using a tree entry */
 #define WINE_RB_FOR_EACH_ENTRY(elem, tree, type, field) \
     for ((elem) = WINE_RB_ENTRY_VALUE(wine_rb_head((tree)->root), type, field); \
-         &(elem)->field; \
+         (elem) != WINE_RB_ENTRY_VALUE(0, type, field); \
          (elem) = WINE_RB_ENTRY_VALUE(wine_rb_next(&elem->field), type, field))
 
 /* iterate through the tree using using postorder, making it safe to free the entry */
@@ -159,7 +159,7 @@ static inline struct wine_rb_entry *wine_rb_postorder_next(struct wine_rb_entry
 /* iterate through the tree using a tree entry and postorder, making it safe to free the entry */
 #define WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
     for ((elem) = WINE_RB_ENTRY_VALUE(wine_rb_postorder_head((tree)->root), type, field); \
-         &(elem)->field \
+         (elem) != WINE_RB_ENTRY_VALUE(0, type, field) \
              && (((elem2) = WINE_RB_ENTRY_VALUE(wine_rb_postorder_next(&(elem)->field), type, field)) || 1); \
          (elem) = (elem2))
 




More information about the wine-cvs mailing list