diff -r bf3695fee719 -r 481802342fdf ucx/list.c --- a/ucx/list.c Mon Feb 04 14:11:57 2019 +0100 +++ b/ucx/list.c Mon Feb 04 17:17:48 2019 +0100 @@ -77,6 +77,7 @@ } void ucx_list_free_content(UcxList* list, ucx_destructor destr) { + if (!destr) destr = free; while (list != NULL) { destr(list->data); list = list->next; @@ -106,41 +107,6 @@ } } -UcxList *ucx_list_append_once(UcxList *l, void *data, - cmp_func cmpfnc, void *cmpdata) { - return ucx_list_append_once_a(ucx_default_allocator(), l, - data, cmpfnc, cmpdata); -} - -UcxList *ucx_list_append_once_a(UcxAllocator *alloc, UcxList *l, void *data, - cmp_func cmpfnc, void *cmpdata) { - - UcxList *last = NULL; - { - UcxList *e = l; - while (e) { - if (cmpfnc(e->data, data, cmpdata) == 0) { - return l; - } - last = e; - e = e->next; - } - } - - UcxList *nl = ucx_list_append_a(alloc, NULL, data); - if (!nl) { - return NULL; - } - - if (last == NULL) { - return nl; - } else { - nl->prev = last; - last->next = nl; - return l; - } -} - UcxList *ucx_list_prepend(UcxList *l, void *data) { return ucx_list_prepend_a(ucx_default_allocator(), l, data); }