rbtree.h: Get rid of no longer needed wine_rb_stack.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-08-15 21:54:20 +02:00 committed by Alexandre Julliard
parent e3a19d3b2f
commit 69f571dbeb

View File

@ -3,6 +3,7 @@
*
* Copyright 2009 Henri Verbeet
* Copyright 2009 Andrew Riedi
* Copyright 2016 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -33,13 +34,6 @@ struct wine_rb_entry
unsigned int flags;
};
struct wine_rb_stack
{
struct wine_rb_entry ***entries;
size_t count;
size_t size;
};
struct wine_rb_functions
{
void *(*alloc)(size_t size);
@ -52,42 +46,11 @@ struct wine_rb_tree
{
const struct wine_rb_functions *functions;
struct wine_rb_entry *root;
struct wine_rb_stack stack;
};
typedef void (wine_rb_traverse_func_t)(struct wine_rb_entry *entry, void *context);
#define WINE_RB_FLAG_RED 0x1
#define WINE_RB_FLAG_STOP 0x2
static inline void wine_rb_stack_clear(struct wine_rb_stack *stack)
{
stack->count = 0;
}
static inline void wine_rb_stack_push(struct wine_rb_stack *stack, struct wine_rb_entry **entry)
{
stack->entries[stack->count++] = entry;
}
static inline int wine_rb_ensure_stack_size(struct wine_rb_tree *tree, size_t size)
{
struct wine_rb_stack *stack = &tree->stack;
if (size > stack->size)
{
size_t new_size = stack->size << 1;
struct wine_rb_entry ***new_entries = tree->functions->realloc(stack->entries,
new_size * sizeof(*stack->entries));
if (!new_entries) return -1;
stack->entries = new_entries;
stack->size = new_size;
}
return 0;
}
static inline int wine_rb_is_red(struct wine_rb_entry *entry)
{
@ -171,11 +134,6 @@ static inline int wine_rb_init(struct wine_rb_tree *tree, const struct wine_rb_f
tree->functions = functions;
tree->root = NULL;
tree->stack.entries = functions->alloc(16 * sizeof(*tree->stack.entries));
if (!tree->stack.entries) return -1;
tree->stack.size = 16;
tree->stack.count = 0;
return 0;
}
@ -194,7 +152,6 @@ static inline void wine_rb_clear(struct wine_rb_tree *tree, wine_rb_traverse_fun
static inline void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
{
wine_rb_clear(tree, callback, context);
tree->functions->free(tree->stack.entries);
}
static inline struct wine_rb_entry *wine_rb_get(const struct wine_rb_tree *tree, const void *key)