aboutsummaryrefslogtreecommitdiff
path: root/src/common/libalgo
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-14 19:59:50 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-14 19:59:50 +0100
commitdc86ed35a4a41ab53bb595e69fe57c29264fd146 (patch)
treefee2b87d32919d5ddb158ef2254546c7543b3ee4 /src/common/libalgo
parentddd908706354fa9c4e2dbaa9f62b11078b06bf19 (diff)
downloadkogata-dc86ed35a4a41ab53bb595e69fe57c29264fd146.tar.gz
kogata-dc86ed35a4a41ab53bb595e69fe57c29264fd146.zip
Add lower/upper bound test ; fix id_key_cmp_fun.
Diffstat (limited to 'src/common/libalgo')
-rw-r--r--src/common/libalgo/btree.c1
-rw-r--r--src/common/libalgo/keyval.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/common/libalgo/btree.c b/src/common/libalgo/btree.c
index 08a43ef..20323aa 100644
--- a/src/common/libalgo/btree.c
+++ b/src/common/libalgo/btree.c
@@ -261,6 +261,7 @@ void* btree_upper(btree_t *t, const void* key) {
return i->val;
}
+
void btree_iter(btree_t *t, kv_iter_fun_t f) {
void iter_aux(btree_item_t *i, kv_iter_fun_t f) {
if (i == 0) return;
diff --git a/src/common/libalgo/keyval.c b/src/common/libalgo/keyval.c
index 0368aed..528fa90 100644
--- a/src/common/libalgo/keyval.c
+++ b/src/common/libalgo/keyval.c
@@ -26,7 +26,7 @@ bool str_key_eq_fun(const void* a, const void* b) {
}
int id_key_cmp_fun(const void* a, const void* b) {
- return (b == a ? 0 : (b > a ? 1 : -1));
+ return (a == b ? 0 : (a < b ? -1 : 1));
}
int str_key_cmp_fun(const void* a, const void* b) {