Commit b3257f90 authored by Yoni Fogel's avatar Yoni Fogel

parent 7ebfaad0
...@@ -59,9 +59,9 @@ static struct toku_rbt_node* toku_rbt__insert( ...@@ -59,9 +59,9 @@ static struct toku_rbt_node* toku_rbt__insert(
static struct toku_rbt_node *toku_rbt__lookup(int, const toku_range * , struct toku_rbt_tree *, struct toku_rbt_node**); static struct toku_rbt_node *toku_rbt__lookup(int, const toku_range * , struct toku_rbt_tree *, struct toku_rbt_node**);
static void toku_rbt__destroy(struct toku_rbt_node *); static void toku_rbt__destroy(struct toku_rbt_tree *rbinfo, struct toku_rbt_node *);
static void toku_rbt__delete(struct toku_rbt_node **, struct toku_rbt_node *); static void toku_rbt__delete(struct toku_rbt_tree* rbinfo, struct toku_rbt_node **, struct toku_rbt_node *);
static void toku_rbt__delete_fix(struct toku_rbt_node **, struct toku_rbt_node *); static void toku_rbt__delete_fix(struct toku_rbt_node **, struct toku_rbt_node *);
/* /*
...@@ -132,7 +132,7 @@ toku_rbt_destroy(struct toku_rbt_tree *rbinfo) ...@@ -132,7 +132,7 @@ toku_rbt_destroy(struct toku_rbt_tree *rbinfo)
return; return;
if (rbinfo->rb_root!=RBNULL) if (rbinfo->rb_root!=RBNULL)
toku_rbt__destroy(rbinfo->rb_root); toku_rbt__destroy(rbinfo, rbinfo->rb_root);
rbinfo->rb_free(rbinfo); rbinfo->rb_free(rbinfo);
} }
...@@ -141,7 +141,7 @@ int toku_rbt_finger_delete(struct toku_rbt_node* node, struct toku_rbt_tree *rbi ...@@ -141,7 +141,7 @@ int toku_rbt_finger_delete(struct toku_rbt_node* node, struct toku_rbt_tree *rbi
int r = ENOSYS; int r = ENOSYS;
if (!rbinfo || !node || node == RBNULL) { r = EINVAL; goto cleanup; } if (!rbinfo || !node || node == RBNULL) { r = EINVAL; goto cleanup; }
toku_rbt__delete(&rbinfo->rb_root, node); toku_rbt__delete(rbinfo, &rbinfo->rb_root, node);
r = 0; r = 0;
cleanup: cleanup:
return r; return r;
...@@ -424,14 +424,14 @@ toku_rbt__lookup(int mode, const toku_range *key, struct toku_rbt_tree *rbinfo, ...@@ -424,14 +424,14 @@ toku_rbt__lookup(int mode, const toku_range *key, struct toku_rbt_tree *rbinfo,
* only useful as part of a complete tree destroy. * only useful as part of a complete tree destroy.
*/ */
static void static void
toku_rbt__destroy(struct toku_rbt_node *x) toku_rbt__destroy(struct toku_rbt_tree *rbinfo, struct toku_rbt_node *x)
{ {
if (x!=RBNULL) if (x!=RBNULL)
{ {
if (x->left!=RBNULL) if (x->left!=RBNULL)
toku_rbt__destroy(x->left); toku_rbt__destroy(rbinfo, x->left);
if (x->right!=RBNULL) if (x->right!=RBNULL)
toku_rbt__destroy(x->right); toku_rbt__destroy(rbinfo, x->right);
toku_rbt__free(rbinfo,x); toku_rbt__free(rbinfo,x);
} }
} }
...@@ -642,7 +642,7 @@ const toku_range* toku_rbt_finger_insert( ...@@ -642,7 +642,7 @@ const toku_range* toku_rbt_finger_insert(
/* Delete the node z, and free up the space /* Delete the node z, and free up the space
*/ */
static void static void
toku_rbt__delete(struct toku_rbt_node **rootp, struct toku_rbt_node *z) toku_rbt__delete(struct toku_rbt_tree* rbinfo, struct toku_rbt_node **rootp, struct toku_rbt_node *z)
{ {
struct toku_rbt_node *x, *y; struct toku_rbt_node *x, *y;
......
...@@ -53,7 +53,10 @@ struct toku_rbt_tree { ...@@ -53,7 +53,10 @@ struct toku_rbt_tree {
int toku_rbt_init ( int toku_rbt_init (
int (*cmp)(const toku_range*, const toku_range*), int (*cmp)(const toku_range*, const toku_range*),
struct toku_rbt_tree** ptree struct toku_rbt_tree** ptree,
void* (*user_malloc) (size_t),
void (*user_free) (void*),
void* (*user_realloc)(void*, size_t)
); );
int toku_rbt_lookup( int toku_rbt_lookup(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment