Fix windows compile issues.
This commit is contained in:
parent
3dcbb63a31
commit
594801df46
|
@ -126,8 +126,8 @@ EXO_TEST(rbtree_iterate_10000, {
|
||||||
|
|
||||||
static void free_node(struct rb_node* n)
|
static void free_node(struct rb_node* n)
|
||||||
{
|
{
|
||||||
hub_free(n->key);
|
hub_free((void*) n->key);
|
||||||
hub_free(n->value);
|
hub_free((void*) n->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXO_TEST(rbtree_remove_5000, {
|
EXO_TEST(rbtree_remove_5000, {
|
||||||
|
|
|
@ -117,10 +117,11 @@ static struct rb_node* rb_tree_rotate_double(struct rb_node* node, int dir)
|
||||||
|
|
||||||
static struct rb_node* rb_tree_insert_r(struct rb_tree* tree, struct rb_node* node, const void* key, const void* value)
|
static struct rb_node* rb_tree_insert_r(struct rb_tree* tree, struct rb_node* node, const void* key, const void* value)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
if (!node)
|
if (!node)
|
||||||
return create_node(tree, key, value);
|
return create_node(tree, key, value);
|
||||||
|
|
||||||
int res = tree->compare(node->key, key);
|
res = tree->compare(node->key, key);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
puts("Node already exists!");
|
puts("Node already exists!");
|
||||||
|
@ -171,15 +172,15 @@ struct rb_tree* rb_tree_create(rb_tree_compare compare, rb_tree_alloc a, rb_tree
|
||||||
void rb_tree_destroy(struct rb_tree* tree)
|
void rb_tree_destroy(struct rb_tree* tree)
|
||||||
{
|
{
|
||||||
list_destroy(tree->iterator.stack);
|
list_destroy(tree->iterator.stack);
|
||||||
rb_tree_free f = tree->free;
|
tree->free(tree);
|
||||||
f(tree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rb_tree_insert(struct rb_tree* tree, const void* key, const void* value)
|
int rb_tree_insert(struct rb_tree* tree, const void* key, const void* value)
|
||||||
{
|
{
|
||||||
|
struct rb_node* node;
|
||||||
if (tree_search(tree, key))
|
if (tree_search(tree, key))
|
||||||
return 0;
|
return 0;
|
||||||
struct rb_node* node = rb_tree_insert_r(tree, tree->root, key, value);
|
node = rb_tree_insert_r(tree, tree->root, key, value);
|
||||||
tree->root = node;
|
tree->root = node;
|
||||||
tree->root->red = 0;
|
tree->root->red = 0;
|
||||||
tree->elements++;
|
tree->elements++;
|
||||||
|
|
Loading…
Reference in New Issue