1.1 --- a/src/list.c Sun Mar 05 10:55:32 2023 +0100 1.2 +++ b/src/list.c Tue Mar 14 20:25:24 2023 +0100 1.3 @@ -95,6 +95,10 @@ 1.4 return list->climpl->remove(list, index); 1.5 } 1.6 1.7 +static void cx_pl_clear(struct cx_list_s *list) { 1.8 + list->climpl->clear(list); 1.9 +} 1.10 + 1.11 static int cx_pl_swap( 1.12 struct cx_list_s *list, 1.13 size_t i, 1.14 @@ -164,6 +168,7 @@ 1.15 cx_pl_insert_array, 1.16 cx_pl_insert_iter, 1.17 cx_pl_remove, 1.18 + cx_pl_clear, 1.19 cx_pl_swap, 1.20 cx_pl_at, 1.21 cx_pl_find, 1.22 @@ -192,6 +197,24 @@ 1.23 1.24 // </editor-fold> 1.25 1.26 +void cx_list_invoke_destructor( 1.27 + CxList const *list, 1.28 + void *elem 1.29 +) { 1.30 + switch (list->content_destructor_type) { 1.31 + case CX_DESTRUCTOR_SIMPLE: { 1.32 + list->simple_destructor(elem); 1.33 + break; 1.34 + } 1.35 + case CX_DESTRUCTOR_ADVANCED: { 1.36 + list->advanced_destructor.func(list->advanced_destructor.data, elem); 1.37 + break; 1.38 + } 1.39 + case CX_DESTRUCTOR_NONE: 1.40 + break; // nothing 1.41 + } 1.42 +} 1.43 + 1.44 void cxListDestroy(CxList *list) { 1.45 switch (list->content_destructor_type) { 1.46 case CX_DESTRUCTOR_SIMPLE: {