src/array_list.c

changeset 629
6c81ee4f11ad
parent 628
1e2be40f0cb5
child 630
ac5e7f789048
equal deleted inserted replaced
628:1e2be40f0cb5 629:6c81ee4f11ad
183 1, 183 1,
184 &arl->reallocator 184 &arl->reallocator
185 ); 185 );
186 } 186 }
187 187
188 static size_t cx_arl_add_array(
189 struct cx_list_s *list,
190 void const *array,
191 size_t n
192 ) {
193 cx_array_list *arl = (cx_array_list *) list;
194 if (CX_ARRAY_COPY_SUCCESS == cx_array_copy(
195 &arl->data,
196 &list->size,
197 &list->capacity,
198 list->size,
199 array,
200 list->itemsize,
201 n,
202 &arl->reallocator
203 )) {
204 return n;
205 } else {
206 // array list implementation is "all or nothing"
207 return 0;
208 }
209 }
210
188 static int cx_arl_insert( 211 static int cx_arl_insert(
189 struct cx_list_s *list, 212 struct cx_list_s *list,
190 size_t index, 213 size_t index,
191 void const *elem 214 void const *elem
192 ) { 215 ) {
383 } 406 }
384 407
385 static cx_list_class cx_array_list_class = { 408 static cx_list_class cx_array_list_class = {
386 cx_arl_destructor, 409 cx_arl_destructor,
387 cx_arl_add, 410 cx_arl_add,
411 cx_arl_add_array,
388 cx_arl_insert, 412 cx_arl_insert,
389 cx_arl_insert_iter, 413 cx_arl_insert_iter,
390 cx_arl_remove, 414 cx_arl_remove,
391 cx_arl_at, 415 cx_arl_at,
392 cx_arl_find, 416 cx_arl_find,

mercurial