@cryptotaxi247 / netdata-1 / commits / 97608f6e9

update the AVL header comments to reflect the new AVL calls

Costa Tsaousis committed Aug 1, 2016 at 01:28 UTC 97608f6e91d00d6a50baae933403c87e18ee765a
1 file changed +10 -8
src/avl.h
+10 -8
@@ -51,23 +51,25 @@ typedef struct avl_tree_lock {
51 /* Public methods */
52
53 /* Insert element a into the AVL tree t
54 - * returns 1 if the depth of the tree has grown
55 - * Warning: do not insert elements already present
54 + * returns the added element a, or a pointer the
55 + * element that is equal to a (as returned by t->compar())
56 + * a is linked directly to the tree, so it has to
57 + * be properly allocated by the caller.
58 */
59 avl *avl_insert_lock(avl_tree_lock *t, avl *a);
60 avl *avl_insert(avl_tree *t, avl *a);
61
62 /* Remove an element a from the AVL tree t
61 - * returns -1 if the depth of the tree has shrunk
62 - * Warning: if the element is not present in the tree,
63 - * returns 0 as if it had been removed succesfully.
63 + * returns a pointer to the removed element
64 + * or NULL if an element equal to a is not found
65 + * (equal as returned by t->compar())
66 */
67 avl *avl_remove_lock(avl_tree_lock *t, avl *a);
68 avl *avl_remove(avl_tree *t, avl *a);
69
68 -/* Iterate through elements in t equal to a
69 - * for each element calls iter(a) until it returns 0
70 - * returns the last value returned by iterator or 0 if there were no calls
70 +/* Find the element into the tree that equal to a
71 + * (equal as returned by t->compar())
72 + * returns NULL is no element is equal to a
73 */
74 avl *avl_search_lock(avl_tree_lock *t, avl *a);
75 avl *avl_search(avl_tree *t, avl *a);