src/ucx/avl.h

changeset 287
98da78a1e69a
parent 259
2f5dea574a75
child 308
d6f580621512
equal deleted inserted replaced
286:85f55abea563 287:98da78a1e69a
133 */ 133 */
134 UcxAVLTree *ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator); 134 UcxAVLTree *ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator);
135 135
136 /** 136 /**
137 * Destroys a UcxAVLTree. 137 * Destroys a UcxAVLTree.
138 *
139 * Note, that the contents are not automatically freed.
140 * Use may use #ucx_avl_free_content() before calling this function.
141 *
138 * @param tree the tree to destroy 142 * @param tree the tree to destroy
143 * @see ucx_avl_free_content()
139 */ 144 */
140 void ucx_avl_free(UcxAVLTree *tree); 145 void ucx_avl_free(UcxAVLTree *tree);
146
147 /**
148 * Frees the contents of a UcxAVLTree.
149 *
150 * This is a convenience function that iterates over the tree and passes all
151 * values to the specified destructor function.
152 *
153 * If no destructor is specified (<code>NULL</code>), the free() function of
154 * the tree's own allocator is used.
155 *
156 * You must ensure, that it is valid to pass each value in the map to the same
157 * destructor function.
158 *
159 * You should free the entire tree afterwards, as the contents will be invalid.
160 *
161 * @param tree for which the contents shall be freed
162 * @param destr optional pointer to a destructor function
163 * @see ucx_avl_free()
164 */
165 void ucx_avl_free_content(UcxAVLTree *tree, ucx_destructor destr);
141 166
142 /** 167 /**
143 * Macro for initializing a new UcxAVLTree with the default allocator and a 168 * Macro for initializing a new UcxAVLTree with the default allocator and a
144 * ucx_ptrcmp() compare function. 169 * ucx_ptrcmp() compare function.
145 * 170 *

mercurial