aboutsummaryrefslogtreecommitdiff
path: root/src/common/libalgo
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-13 23:11:55 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-13 23:11:55 +0200
commitd09f8a08bdd9477bd463a2de03397ff56b5ce75d (patch)
tree4818750ff1fccd02f24e6f2089937190d2e6724b /src/common/libalgo
parent8a89ad4b01bafcdb64349e81fb4883a6c5f45187 (diff)
downloadkogata-d09f8a08bdd9477bd463a2de03397ff56b5ce75d.tar.gz
kogata-d09f8a08bdd9477bd463a2de03397ff56b5ce75d.zip
Add delta wrt. function in stack dump
Diffstat (limited to 'src/common/libalgo')
-rw-r--r--src/common/libalgo/btree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/libalgo/btree.c b/src/common/libalgo/btree.c
index 6bc0fdc..45fde1e 100644
--- a/src/common/libalgo/btree.c
+++ b/src/common/libalgo/btree.c
@@ -272,7 +272,7 @@ void* btree_find(btree_t *t, const void* key) {
return i->val;
}
-void* btree_lower(btree_t *t, const void* key) {
+void* btree_lower(btree_t *t, const void* key, void** actual_key) {
btree_item_t *find_aux(btree_t *t, btree_item_t *i, const void* key) {
if (i == 0) return 0;
@@ -291,10 +291,11 @@ void* btree_lower(btree_t *t, const void* key) {
btree_item_t *i = find_aux(t, t->root, key);
if (i == 0) return 0;
+ if (actual_key != 0) *actual_key = i->key;
return i->val;
}
-void* btree_upper(btree_t *t, const void* key) {
+void* btree_upper(btree_t *t, const void* key, void** actual_key) {
btree_item_t *find_aux(btree_t *t, btree_item_t *i, const void* key) {
if (i == 0) return 0;
@@ -313,6 +314,7 @@ void* btree_upper(btree_t *t, const void* key) {
btree_item_t *i = find_aux(t, t->root, key);
if (i == 0) return 0;
+ if (actual_key != 0) *actual_key = i->key;
return i->val;
}