src/array_list.c

changeset 874
cdce47f34d48
parent 856
6bbbf219251d
child 876
f4ce7df9cff0
equal deleted inserted replaced
872:d607a184925a 874:cdce47f34d48
282 int result = cx_arl_insert_element( 282 int result = cx_arl_insert_element(
283 list, 283 list,
284 iter->index + 1 - prepend, 284 iter->index + 1 - prepend,
285 elem 285 elem
286 ); 286 );
287 if (result == 0 && prepend != 0) { 287 if (result == 0) {
288 iter->index++; 288 iter->elem_count++;
289 iter->elem_handle = ((char *) iter->elem_handle) + list->collection.elem_size; 289 if (prepend != 0) {
290 iter->index++;
291 iter->elem_handle = ((char *) iter->elem_handle) + list->collection.elem_size;
292 }
290 } 293 }
291 return result; 294 return result;
292 } else { 295 } else {
293 int result = cx_arl_insert_element(list, list->collection.size, elem); 296 int result = cx_arl_insert_element(list, list->collection.size, elem);
294 iter->index = list->collection.size; 297 if (result == 0) {
298 iter->elem_count++;
299 iter->index = list->collection.size;
300 }
295 return result; 301 return result;
296 } 302 }
297 } 303 }
298 304
299 static int cx_arl_remove( 305 static int cx_arl_remove(

mercurial