summaryrefslogtreecommitdiffstats
path: root/tree.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-29 07:14:40 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-29 07:14:40 -0700
commitbc483048cfc2c9db80f4fcca18e882d646d30510 (patch)
tree124cda8cd39785e21393903115c43d947f16b566 /tree.c
parente3642f07ef877609d45f3dc737e686957d675d8a (diff)
downloadtxr-bc483048cfc2c9db80f4fcca18e882d646d30510.tar.gz
txr-bc483048cfc2c9db80f4fcca18e882d646d30510.tar.bz2
txr-bc483048cfc2c9db80f4fcca18e882d646d30510.zip
tree: incorrect lookup function.
* tree.c (tn_lookup): The right case is incorrectly chasing the left pointer. * tests/010/tree.tl: New file.
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index 30362ddb..4d378ced 100644
--- a/tree.c
+++ b/tree.c
@@ -170,7 +170,7 @@ static val tn_lookup(struct tree *tr, val node, val key)
funcall2(tr->equal_fn, key, tr_key))) {
return node;
} else {
- return if2(node->tn.left, tn_lookup(tr, node->tn.left, key));
+ return if2(node->tn.right, tn_lookup(tr, node->tn.right, key));
}
}