projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4d37668
)
src/utils_avltree.c: Fix an off-by-one error in c_avl_insert().
author
Florian Forster
<octo@collectd.org>
Mon, 8 Oct 2012 14:20:34 +0000
(16:20 +0200)
committer
Florian Forster
<octo@collectd.org>
Mon, 8 Oct 2012 14:20:34 +0000
(16:20 +0200)
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
patch
|
blob
|
history
diff --git
a/src/utils_avltree.c
b/src/utils_avltree.c
index
ba7cd95
..
f71b1fd
100644
(file)
--- 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);
}