src/ucx/avl.h

changeset 287
98da78a1e69a
parent 259
2f5dea574a75
child 308
d6f580621512
     1.1 --- a/src/ucx/avl.h	Thu May 03 10:09:49 2018 +0200
     1.2 +++ b/src/ucx/avl.h	Thu May 03 10:44:33 2018 +0200
     1.3 @@ -135,11 +135,36 @@
     1.4  
     1.5  /**
     1.6   * Destroys a UcxAVLTree.
     1.7 + * 
     1.8 + * Note, that the contents are not automatically freed.
     1.9 + * Use may use #ucx_avl_free_content() before calling this function.
    1.10 + * 
    1.11   * @param tree the tree to destroy
    1.12 + * @see ucx_avl_free_content()
    1.13   */
    1.14  void ucx_avl_free(UcxAVLTree *tree);
    1.15  
    1.16  /**
    1.17 + * Frees the contents of a UcxAVLTree.
    1.18 + * 
    1.19 + * This is a convenience function that iterates over the tree and passes all
    1.20 + * values to the specified destructor function.
    1.21 + * 
    1.22 + * If no destructor is specified (<code>NULL</code>), the free() function of
    1.23 + * the tree's own allocator is used.
    1.24 + * 
    1.25 + * You must ensure, that it is valid to pass each value in the map to the same
    1.26 + * destructor function.
    1.27 + * 
    1.28 + * You should free the entire tree afterwards, as the contents will be invalid.
    1.29 + * 
    1.30 + * @param tree for which the contents shall be freed
    1.31 + * @param destr optional pointer to a destructor function
    1.32 + * @see ucx_avl_free()
    1.33 + */
    1.34 +void ucx_avl_free_content(UcxAVLTree *tree, ucx_destructor destr);
    1.35 +
    1.36 +/**
    1.37   * Macro for initializing a new UcxAVLTree with the default allocator and a
    1.38   * ucx_ptrcmp() compare function.
    1.39   * 

mercurial