144 |
144 |
145 /** |
145 /** |
146 * Destroys the entire list. |
146 * Destroys the entire list. |
147 * |
147 * |
148 * The members of the list are not automatically freed, so ensure they are |
148 * The members of the list are not automatically freed, so ensure they are |
149 * otherwise referenced or a memory leak will occur. |
149 * otherwise referenced or destroyed by ucx_list_free_contents(). |
|
150 * Otherwise, a memory leak is likely to occur. |
150 * |
151 * |
151 * <b>Caution:</b> the argument <b>MUST</b> denote an entire list (i.e. a call |
152 * <b>Caution:</b> the argument <b>MUST</b> denote an entire list (i.e. a call |
152 * to ucx_list_first() on the argument must return the argument itself) |
153 * to ucx_list_first() on the argument must return the argument itself) |
153 * |
154 * |
154 * @param list the list to free |
155 * @param list the list to free |
|
156 * @see ucx_list_free_contents() |
155 */ |
157 */ |
156 void ucx_list_free(UcxList *list); |
158 void ucx_list_free(UcxList *list); |
157 |
159 |
158 /** |
160 /** |
159 * Destroys the entire list using an UcxAllocator. |
161 * Destroys the entire list using an UcxAllocator. |
163 * @param allocator the allocator to use |
165 * @param allocator the allocator to use |
164 * @param list the list to free |
166 * @param list the list to free |
165 * @see ucx_list_free() |
167 * @see ucx_list_free() |
166 */ |
168 */ |
167 void ucx_list_free_a(UcxAllocator *allocator, UcxList *list); |
169 void ucx_list_free_a(UcxAllocator *allocator, UcxList *list); |
|
170 |
|
171 /** |
|
172 * Destroys the contents of the specified list by calling the specified |
|
173 * destructor on each of them. |
|
174 * |
|
175 * Note, that the contents are not usable afterwards and the list should be |
|
176 * destroyed with ucx_list_free(). |
|
177 * |
|
178 * @param list the list for which the contents shall be freed |
|
179 * @param destr the destructor function (e.g. stdlib free()) |
|
180 * @see ucx_list_free() |
|
181 */ |
|
182 void ucx_list_free_contents(UcxList* list, ucx_destructor destr); |
|
183 |
168 |
184 |
169 /** |
185 /** |
170 * Inserts an element at the end of the list. |
186 * Inserts an element at the end of the list. |
171 * |
187 * |
172 * This is generally an O(n) operation, as the end of the list is retrieved with |
188 * This is generally an O(n) operation, as the end of the list is retrieved with |