src/linked_list.c

changeset 436
ca9ce2297c29
parent 435
0fe204d50f54
child 437
9d4971ea0625
equal deleted inserted replaced
435:0fe204d50f54 436:ca9ce2297c29
175 cxLinkedListRecalculateSize(result); 175 cxLinkedListRecalculateSize(result);
176 return result; 176 return result;
177 } 177 }
178 178
179 void cxLinkedListDestroy(CxList list) { 179 void cxLinkedListDestroy(CxList list) {
180 // TODO: free contents 180 cx_linked_list* ll = (cx_linked_list*) list;
181
182 struct cx_linked_list_node* node = ll->begin;
183 while (node) {
184 void* next = node->next;
185 cxFree(list->allocator, node);
186 node = next;
187 }
188
181 cxFree(list->allocator, list); 189 cxFree(list->allocator, list);
182 } 190 }
183 191
184 size_t cxLinkedListRecalculateSize(CxList list) { 192 size_t cxLinkedListRecalculateSize(CxList list) {
185 cx_linked_list *ll = (cx_linked_list *) list; 193 cx_linked_list *ll = (cx_linked_list *) list;

mercurial