src/linked_list.c

changeset 1433
81c301a59b7c
parent 1429
6e0c3a8a914a
child 1435
48ebf22b698e
equal deleted inserted replaced
1432:fb82e7a92258 1433:81c301a59b7c
750 node = node == NULL ? ((cx_linked_list *) list)->begin : CX_LL_PTR(node, ll->loc_next); 750 node = node == NULL ? ((cx_linked_list *) list)->begin : CX_LL_PTR(node, ll->loc_next);
751 751
752 // we can add the remaining nodes and immediately advance to the inserted node 752 // we can add the remaining nodes and immediately advance to the inserted node
753 const char *source = array; 753 const char *source = array;
754 for (size_t i = 1; i < n; i++) { 754 for (size_t i = 1; i < n; i++) {
755 source += list->collection.elem_size; 755 if (source != NULL) {
756 source += list->collection.elem_size;
757 }
756 if (0 != cx_ll_insert_at(list, node, source)) return i; 758 if (0 != cx_ll_insert_at(list, node, source)) return i;
757 node = CX_LL_PTR(node, ll->loc_next); 759 node = CX_LL_PTR(node, ll->loc_next);
758 } 760 }
759 return n; 761 return n;
760 } 762 }

mercurial