src/linked_list.c

changeset 666
b5dd654deb3b
parent 664
af5bf4603a5d
child 667
2f88a7c13a28
equal deleted inserted replaced
665:c4041b07165e 666:b5dd654deb3b
596 // looks super redundant, but avoids repeatedly checking 596 // looks super redundant, but avoids repeatedly checking
597 // the destructor type for each element 597 // the destructor type for each element
598 switch (list->content_destructor_type) { 598 switch (list->content_destructor_type) {
599 case CX_DESTRUCTOR_SIMPLE: { 599 case CX_DESTRUCTOR_SIMPLE: {
600 while (node != NULL) { 600 while (node != NULL) {
601 list->simple_destructor(node->payload); 601 cx_list_invoke_simple_destructor(list, node->payload);
602 cx_linked_list_node *next = node->next; 602 cx_linked_list_node *next = node->next;
603 cxFree(list->allocator, node); 603 cxFree(list->allocator, node);
604 node = next; 604 node = next;
605 } 605 }
606 break; 606 break;
607 } 607 }
608 case CX_DESTRUCTOR_ADVANCED: { 608 case CX_DESTRUCTOR_ADVANCED: {
609 while (node != NULL) { 609 while (node != NULL) {
610 list->advanced_destructor.func(list->advanced_destructor.data, 610 cx_list_invoke_advanced_destructor(list, node->payload);
611 node->payload);
612 cx_linked_list_node *next = node->next; 611 cx_linked_list_node *next = node->next;
613 cxFree(list->allocator, node); 612 cxFree(list->allocator, node);
614 node = next; 613 node = next;
615 } 614 }
616 break; 615 break;

mercurial