From bc483048cfc2c9db80f4fcca18e882d646d30510 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 29 Apr 2021 07:14:40 -0700 Subject: tree: incorrect lookup function. * tree.c (tn_lookup): The right case is incorrectly chasing the left pointer. * tests/010/tree.tl: New file. --- tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tree.c') 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)); } } -- cgit v1.2.3