rbtree.h: Add a wine_rb_prev iteration helper function.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
917d98a457
commit
c1d46149e0
|
@ -101,6 +101,13 @@ static inline struct wine_rb_entry *wine_rb_head(struct wine_rb_entry *iter)
|
|||
return iter;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_tail(struct wine_rb_entry *iter)
|
||||
{
|
||||
if (!iter) return NULL;
|
||||
while (iter->right) iter = iter->right;
|
||||
return iter;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_next(struct wine_rb_entry *iter)
|
||||
{
|
||||
if (iter->right) return wine_rb_head(iter->right);
|
||||
|
@ -108,6 +115,13 @@ static inline struct wine_rb_entry *wine_rb_next(struct wine_rb_entry *iter)
|
|||
return iter->parent;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_prev(struct wine_rb_entry *iter)
|
||||
{
|
||||
if (iter->left) return wine_rb_tail(iter->left);
|
||||
while (iter->parent && iter->parent->left == iter) iter = iter->parent;
|
||||
return iter->parent;
|
||||
}
|
||||
|
||||
static inline struct wine_rb_entry *wine_rb_postorder_head(struct wine_rb_entry *iter)
|
||||
{
|
||||
if (!iter) return NULL;
|
||||
|
|
Loading…
Reference in New Issue