270 if (index >= list->size) { |
270 if (index >= list->size) { |
271 return 1; |
271 return 1; |
272 } |
272 } |
273 |
273 |
274 // content destruction |
274 // content destruction |
275 cx_invoke_destructor(list, ((char*)arl->data) + index * list->item_size); |
275 cx_invoke_destructor(list, ((char *) arl->data) + index * list->item_size); |
276 |
276 |
277 // short-circuit removal of last element |
277 // short-circuit removal of last element |
278 if (index == list->size - 1) { |
278 if (index == list->size - 1) { |
279 list->size--; |
279 list->size--; |
280 return 0; |
280 return 0; |
508 list->capacity = initial_capacity; |
508 list->capacity = initial_capacity; |
509 |
509 |
510 if (item_size > 0) { |
510 if (item_size > 0) { |
511 list->base.item_size = item_size; |
511 list->base.item_size = item_size; |
512 } else { |
512 } else { |
513 item_size = sizeof(void*); |
513 item_size = sizeof(void *); |
514 cxListStorePointers((CxList *) list); |
514 cxListStorePointers((CxList *) list); |
515 } |
515 } |
516 |
516 |
517 // allocate the array after the real item_size is known |
517 // allocate the array after the real item_size is known |
518 list->data = cxCalloc(allocator, initial_capacity, item_size); |
518 list->data = cxCalloc(allocator, initial_capacity, item_size); |