include: Correct the case of rbtree macros.

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 2020-07-31 10:59:54 -05:00 committed by Alexandre Julliard
parent 1279d5df9e
commit 04598b1316

View File

@ -127,33 +127,33 @@ static inline struct rb_entry *rb_postorder_next(struct rb_entry *iter)
}
/* iterate through the tree */
#define rb_FOR_EACH(cursor, tree) \
#define RB_FOR_EACH(cursor, tree) \
for ((cursor) = rb_head((tree)->root); (cursor); (cursor) = rb_next(cursor))
/* 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); \
#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(rb_next(&elem->field), 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 */
#define rb_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
#define RB_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
for ((cursor) = rb_postorder_head((tree)->root); \
(cursor) && (((cursor2) = rb_postorder_next(cursor)) || 1); \
(cursor) = (cursor2))
/* 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); \
#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 \
&& (((elem2) = rb_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
&& (((elem2) = RB_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
(elem) = (elem2))
static inline void rb_postorder(struct rb_tree *tree, rb_traverse_func *callback, void *context)
{
struct rb_entry *iter, *next;
rb_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
RB_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
}
static inline void rb_init(struct rb_tree *tree, rb_compare_func compare)
@ -165,7 +165,7 @@ static inline void rb_init(struct rb_tree *tree, rb_compare_func compare)
static inline void rb_for_each_entry(struct rb_tree *tree, rb_traverse_func *callback, void *context)
{
struct rb_entry *iter;
rb_FOR_EACH(iter, tree) callback(iter, context);
RB_FOR_EACH(iter, tree) callback(iter, context);
}
static inline void rb_clear(struct rb_tree *tree, rb_traverse_func *callback, void *context)