171 * Destroys the contents of the specified list by calling the specified |
171 * Destroys the contents of the specified list by calling the specified |
172 * destructor on each of them. |
172 * destructor on each of them. |
173 * |
173 * |
174 * Note, that the contents are not usable afterwards and the list should be |
174 * Note, that the contents are not usable afterwards and the list should be |
175 * destroyed with ucx_list_free(). |
175 * destroyed with ucx_list_free(). |
|
176 * |
|
177 * If no destructor is specified (<code>NULL</code>), stdlib's free() is used. |
176 * |
178 * |
177 * @param list the list for which the contents shall be freed |
179 * @param list the list for which the contents shall be freed |
178 * @param destr the destructor function (e.g. stdlib free()) |
180 * @param destr optional destructor function |
179 * @see ucx_list_free() |
181 * @see ucx_list_free() |
180 */ |
182 */ |
181 void ucx_list_free_content(UcxList* list, ucx_destructor destr); |
183 void ucx_list_free_content(UcxList* list, ucx_destructor destr); |
182 |
184 |
183 |
185 |
208 * the newly created list otherwise |
210 * the newly created list otherwise |
209 * @see ucx_list_append() |
211 * @see ucx_list_append() |
210 */ |
212 */ |
211 UcxList *ucx_list_append_a(UcxAllocator *allocator, UcxList *list, void *data); |
213 UcxList *ucx_list_append_a(UcxAllocator *allocator, UcxList *list, void *data); |
212 |
214 |
213 /** |
|
214 * Inserts an element at the end of the list, if it is not present in the list. |
|
215 * |
|
216 * |
|
217 * @param list the list where to append the data, or <code>NULL</code> to |
|
218 * create a new list |
|
219 * @param data the data to insert |
|
220 * @param cmpfnc the compare function |
|
221 * @param cmpdata additional data for the compare function |
|
222 * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
|
223 * the newly created list otherwise |
|
224 * @see ucx_list_append() |
|
225 */ |
|
226 UcxList *ucx_list_append_once(UcxList *list, void *data, |
|
227 cmp_func cmpfnc, void *cmpdata); |
|
228 |
|
229 /** |
|
230 * Inserts an element at the end of the list, if it is not present in the list, |
|
231 * using a UcxAllocator. |
|
232 * |
|
233 * See ucx_list_append() for details. |
|
234 * |
|
235 * @param allocator the allocator to use |
|
236 * @param list the list where to append the data, or <code>NULL</code> to |
|
237 * create a new list |
|
238 * @param data the data to insert |
|
239 * @param cmpfnc the compare function |
|
240 * @param cmpdata additional data for the compare function |
|
241 * @return <code>list</code>, if it is not <code>NULL</code> or a pointer to |
|
242 * the newly created list otherwise |
|
243 * @see ucx_list_append_a() |
|
244 */ |
|
245 UcxList *ucx_list_append_once_a(UcxAllocator *allocator, |
|
246 UcxList *list, void *data, cmp_func cmpfnc, void *cmpdata); |
|
247 |
215 |
248 /** |
216 /** |
249 * Inserts an element at the beginning of the list. |
217 * Inserts an element at the beginning of the list. |
250 * |
218 * |
251 * You <i>should</i> overwrite the old list pointer by calling |
219 * You <i>should</i> overwrite the old list pointer by calling |