src/linked_list.c

changeset 467
95e42a963520
parent 466
28bc3e10ac28
child 468
75ae1dccd101
equal deleted inserted replaced
466:28bc3e10ac28 467:95e42a963520
330 node = next; 330 node = next;
331 } 331 }
332 332
333 cxFree(list->allocator, list); 333 cxFree(list->allocator, list);
334 } 334 }
335
336 size_t cxLinkedListRecalculateSize(CxList list) {
337 cx_linked_list *ll = (cx_linked_list *) list;
338
339 if (ll->begin == NULL) {
340 ll->base.size = 0;
341 ll->end = NULL;
342 return 0;
343 } else {
344 cx_linked_list_node *cur = ll->begin;
345 cx_linked_list_node *last;
346 size_t size = 0;
347 do {
348 last = cur;
349 size++;
350 } while ((cur = cur->next) != NULL);
351 ll->end = last;
352 ll->base.size = size;
353 return size;
354 }
355 }

mercurial