From 60c6faf4fe7779e3d2f1c0c807103bbd2ee0c697 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 8 Oct 2012 16:20:34 +0200 Subject: [PATCH] src/utils_avltree.c: Fix an off-by-one error in c_avl_insert(). When inserting the first node in the tree, the size is not incremented. This causes c_avl_size() to return one element too little. Thanks to Yves Mettier for debugging this! --- src/utils_avltree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils_avltree.c b/src/utils_avltree.c index ba7cd95f..f71b1fd6 100644 --- a/src/utils_avltree.c +++ b/src/utils_avltree.c @@ -512,6 +512,7 @@ int c_avl_insert (c_avl_tree_t *t, void *key, void *value) { new->parent = NULL; t->root = new; + t->size = 1; return (0); } -- 2.11.0