aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-14 19:34:49 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-14 19:34:49 +0100
commit8336422c8ad72b98e3af9c038468b62a9eafac3c (patch)
treeb35e74136b0263e6efbba41de8d1b118c2239b9b /src/common
parent1ca147f9e08202dfbc78692e204adac280f8238b (diff)
downloadkogata-8336422c8ad72b98e3af9c038468b62a9eafac3c.tar.gz
kogata-8336422c8ad72b98e3af9c038468b62a9eafac3c.zip
Add first btree test ; fix first btree test.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/libalgo/btree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/libalgo/btree.c b/src/common/libalgo/btree.c
index da0e25b..08a43ef 100644
--- a/src/common/libalgo/btree.c
+++ b/src/common/libalgo/btree.c
@@ -24,7 +24,7 @@ btree_t* create_btree(key_cmp_fun_t cf, kv_iter_fun_t relf) {
if (t == 0) return 0;
t->cf = cf;
- t->releasef = relf;
+ if (t->releasef) t->releasef = relf;
t->root = 0;
t->nitems = 0;
@@ -39,7 +39,7 @@ void delete_btree(btree_t *t) {
delete_item_rec(i->left, relf);
delete_item_rec(i->right, relf);
- relf(i->key, i->val);
+ if (relf) relf(i->key, i->val);
free(i);
}
@@ -182,7 +182,7 @@ void btree_remove(btree_t *t, const void* key) {
new_i = equilibrate(new_i);
}
- t->releasef(i->key, i->val);
+ if (t->releasef) t->releasef(i->key, i->val);
free(i);
t->nitems--;