summaryrefslogtreecommitdiff
path: root/tern.c
diff options
context:
space:
mode:
Diffstat (limited to 'tern.c')
-rw-r--r--tern.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tern.c b/tern.c
index 2929bd6..e4f80f8 100644
--- a/tern.c
+++ b/tern.c
@@ -107,7 +107,11 @@ void * tern_find_ptr_default(tern_node * head, char * key, void * def)
{
tern_val ret;
if (tern_find(head, key, &ret)) {
- return ret.ptrval;
+ if (ret.intval & 1) {
+ return (void *)(ret.intval & ~1);
+ } else {
+ return ret.ptrval;
+ }
}
return def;
}
@@ -193,7 +197,7 @@ void tern_foreach_int(tern_node *head, iter_fun fun, void *data, char *keybuf, i
tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1);
}
if (head->right) {
- tern_foreach_int(head->left, fun, data, keybuf, pos);
+ tern_foreach_int(head->right, fun, data, keybuf, pos);
}
}