30 |
30 |
31 CxList *cxListDestroy(CxList *list) { |
31 CxList *cxListDestroy(CxList *list) { |
32 if (list->content_destructor != NULL) { |
32 if (list->content_destructor != NULL) { |
33 CxIterator iter = cxListBegin(list); |
33 CxIterator iter = cxListBegin(list); |
34 cx_foreach(void*, elem, iter) { |
34 cx_foreach(void*, elem, iter) { |
35 cxFree(list->allocator, list->content_destructor(elem)); |
35 list->content_destructor(elem); |
36 } |
36 } |
37 } |
37 } |
38 list->cl->destructor(list); |
38 list->cl->destructor(list); |
39 cxFree(list->allocator, list); |
39 cxFree(list->allocator, list); |
40 return NULL; |
40 return NULL; |