1.1 --- a/ucx/list.h Thu Oct 15 16:52:53 2015 +0200 1.2 +++ b/ucx/list.h Wed Oct 21 16:32:30 2015 +0200 1.3 @@ -146,12 +146,14 @@ 1.4 * Destroys the entire list. 1.5 * 1.6 * The members of the list are not automatically freed, so ensure they are 1.7 - * otherwise referenced or a memory leak will occur. 1.8 + * otherwise referenced or destroyed by ucx_list_free_contents(). 1.9 + * Otherwise, a memory leak is likely to occur. 1.10 * 1.11 * <b>Caution:</b> the argument <b>MUST</b> denote an entire list (i.e. a call 1.12 * to ucx_list_first() on the argument must return the argument itself) 1.13 * 1.14 * @param list the list to free 1.15 + * @see ucx_list_free_contents() 1.16 */ 1.17 void ucx_list_free(UcxList *list); 1.18 1.19 @@ -167,6 +169,20 @@ 1.20 void ucx_list_free_a(UcxAllocator *allocator, UcxList *list); 1.21 1.22 /** 1.23 + * Destroys the contents of the specified list by calling the specified 1.24 + * destructor on each of them. 1.25 + * 1.26 + * Note, that the contents are not usable afterwards and the list should be 1.27 + * destroyed with ucx_list_free(). 1.28 + * 1.29 + * @param list the list for which the contents shall be freed 1.30 + * @param destr the destructor function (e.g. stdlib free()) 1.31 + * @see ucx_list_free() 1.32 + */ 1.33 +void ucx_list_free_contents(UcxList* list, ucx_destructor destr); 1.34 + 1.35 + 1.36 +/** 1.37 * Inserts an element at the end of the list. 1.38 * 1.39 * This is generally an O(n) operation, as the end of the list is retrieved with