summaryrefslogtreecommitdiffstats
path: root/zix/tree.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-13 17:25:59 +0200
committerDavid Robillard <d@drobilla.net>2020-08-13 17:25:59 +0200
commitd86638c91f89187f72afc532baf565ded0a29b7f (patch)
treeedd779c47c341b7b37ee5ce10b8d3f5b23bb1d0a /zix/tree.c
parent92928586a32a122b5aae69bcc212e98d56a34cc0 (diff)
downloadzix-d86638c91f89187f72afc532baf565ded0a29b7f.tar.gz
zix-d86638c91f89187f72afc532baf565ded0a29b7f.tar.bz2
zix-d86638c91f89187f72afc532baf565ded0a29b7f.zip
Fix duplicate branches
Diffstat (limited to 'zix/tree.c')
-rw-r--r--zix/tree.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/zix/tree.c b/zix/tree.c
index 4dd0897..e0576fb 100644
--- a/zix/tree.c
+++ b/zix/tree.c
@@ -350,9 +350,7 @@ zix_tree_insert(ZixTree* t, void* e, ZixTreeIter** ti)
cmp = t->cmp(e, n->data, t->cmp_data);
if (cmp < 0) {
n = n->left;
- } else if (cmp > 0) {
- n = n->right;
- } else if (t->allow_duplicates) {
+ } else if (cmp > 0 || t->allow_duplicates) {
n = n->right;
} else {
if (ti) {