diff -r d50b5dc1e058 -r af5bf4603a5d src/list.c --- a/src/list.c Sun Mar 05 10:55:32 2023 +0100 +++ b/src/list.c Tue Mar 14 20:25:24 2023 +0100 @@ -95,6 +95,10 @@ return list->climpl->remove(list, index); } +static void cx_pl_clear(struct cx_list_s *list) { + list->climpl->clear(list); +} + static int cx_pl_swap( struct cx_list_s *list, size_t i, @@ -164,6 +168,7 @@ cx_pl_insert_array, cx_pl_insert_iter, cx_pl_remove, + cx_pl_clear, cx_pl_swap, cx_pl_at, cx_pl_find, @@ -192,6 +197,24 @@ // +void cx_list_invoke_destructor( + CxList const *list, + void *elem +) { + switch (list->content_destructor_type) { + case CX_DESTRUCTOR_SIMPLE: { + list->simple_destructor(elem); + break; + } + case CX_DESTRUCTOR_ADVANCED: { + list->advanced_destructor.func(list->advanced_destructor.data, elem); + break; + } + case CX_DESTRUCTOR_NONE: + break; // nothing + } +} + void cxListDestroy(CxList *list) { switch (list->content_destructor_type) { case CX_DESTRUCTOR_SIMPLE: {