1.1 --- a/src/array_list.c Thu Nov 17 18:29:59 2022 +0100 1.2 +++ b/src/array_list.c Thu Nov 17 18:32:59 2022 +0100 1.3 @@ -190,7 +190,29 @@ 1.4 struct cx_list_s *list, 1.5 size_t index 1.6 ) { 1.7 - return 1; 1.8 + /* out-of-bounds check */ 1.9 + if (index >= list->size) { 1.10 + return 1; 1.11 + } 1.12 + 1.13 + cx_array_list *arl = (cx_array_list *) list; 1.14 + 1.15 + /* just move the elements starting at index to the left */ 1.16 + int result = cx_array_copy( 1.17 + &arl->data, 1.18 + &list->size, 1.19 + &list->capacity, 1.20 + index, 1.21 + ((char *) arl->data) + (index + 1) * list->itemsize, 1.22 + list->itemsize, 1.23 + list->size - index, 1.24 + &arl->reallocator 1.25 + ); 1.26 + if (result == 0) { 1.27 + /* decrease the size */ 1.28 + list->size--; 1.29 + } 1.30 + return result; 1.31 } 1.32 1.33 static void *cx_arl_at(