src/list.c

changeset 1065
6eb7b54975ee
parent 993
b642eca4b956
equal deleted inserted replaced
1064:f3b04cd60776 1065:6eb7b54975ee
295 ) { 295 ) {
296 size_t elem_size = list->collection.elem_size; 296 size_t elem_size = list->collection.elem_size;
297 const char *src = data; 297 const char *src = data;
298 size_t i = 0; 298 size_t i = 0;
299 for (; i < n; i++) { 299 for (; i < n; i++) {
300 if (0 != invoke_list_func(insert_element, 300 if (0 != invoke_list_func(
301 list, index + i, src + (i * elem_size))) { 301 insert_element, list, index + i,
302 return i; 302 src + (i * elem_size))) return i;
303 }
304 } 303 }
305 return i; 304 return i;
306 } 305 }
307 306
308 size_t cx_list_default_insert_sorted( 307 size_t cx_list_default_insert_sorted(
343 ins++; 342 ins++;
344 } 343 }
345 344
346 // insert the elements at location si 345 // insert the elements at location si
347 if (ins == 1) { 346 if (ins == 1) {
348 if (0 != invoke_list_func(insert_element, 347 if (0 != invoke_list_func(
349 list, di, src)) 348 insert_element, list, di, src)) return inserted;
350 return inserted;
351 } else { 349 } else {
352 size_t r = invoke_list_func(insert_array, list, di, src, ins); 350 size_t r = invoke_list_func(insert_array, list, di, src, ins);
353 if (r < ins) return inserted + r; 351 if (r < ins) return inserted + r;
354 } 352 }
355 inserted += ins; 353 inserted += ins;

mercurial