-
- // looks super redundant, but avoids repeatedly checking
- // the destructor type for each element
- switch (list->content_destructor_type) {
- case CX_DESTRUCTOR_SIMPLE: {
- while (node != NULL) {
- cx_list_invoke_simple_destructor(list, node->payload);
- cx_linked_list_node *next = node->next;
- cxFree(list->allocator, node);
- node = next;
- }
- break;
- }
- case CX_DESTRUCTOR_ADVANCED: {
- while (node != NULL) {
- cx_list_invoke_advanced_destructor(list, node->payload);
- cx_linked_list_node *next = node->next;
- cxFree(list->allocator, node);
- node = next;
- }
- break;
- }
- case CX_DESTRUCTOR_NONE: {
- while (node != NULL) {
- cx_linked_list_node *next = node->next;
- cxFree(list->allocator, node);
- node = next;
- }
- break;
- }
+ while (node != NULL) {
+ cx_invoke_destructor(list, node->payload);
+ cx_linked_list_node *next = node->next;
+ cxFree(list->allocator, node);
+ node = next;