src/array_list.c

changeset 624
b0bdff7d8203
parent 623
21082350a590
child 625
a4c4a50c067a
equal deleted inserted replaced
623:21082350a590 624:b0bdff7d8203
248 /* out-of-bounds check */ 248 /* out-of-bounds check */
249 if (index >= list->size) { 249 if (index >= list->size) {
250 return 1; 250 return 1;
251 } 251 }
252 252
253 /* short-circuit removal of last element */
254 if (index == list->size - 1) {
255 list->size--;
256 return 0;
257 }
258
259 /* just move the elements starting at index to the left */
253 cx_array_list *arl = (cx_array_list *) list; 260 cx_array_list *arl = (cx_array_list *) list;
254
255 /* just move the elements starting at index to the left */
256 int result = cx_array_copy( 261 int result = cx_array_copy(
257 &arl->data, 262 &arl->data,
258 &list->size, 263 &list->size,
259 &list->capacity, 264 &list->capacity,
260 index, 265 index,

mercurial