ucx/list.c

changeset 115
e57ca2747782
parent 113
dde28a806552
equal deleted inserted replaced
114:3da24640513a 115:e57ca2747782
184 void **ptr = iter->base.current_impl(it); 184 void **ptr = iter->base.current_impl(it);
185 return ptr == NULL ? NULL : *ptr; 185 return ptr == NULL ? NULL : *ptr;
186 } 186 }
187 187
188 static int cx_pl_change_capacity(struct cx_list_s *list, size_t cap) { 188 static int cx_pl_change_capacity(struct cx_list_s *list, size_t cap) {
189 return list->climpl->change_capacity(list, cap); 189 if (list->climpl->change_capacity == NULL) {
190 return 0;
191 } else {
192 return list->climpl->change_capacity(list, cap);
193 }
190 } 194 }
191 195
192 static struct cx_iterator_s cx_pl_iterator( 196 static struct cx_iterator_s cx_pl_iterator(
193 const struct cx_list_s *list, 197 const struct cx_list_s *list,
194 size_t index, 198 size_t index,
1024 bool dst_was_empty = cxCollectionSize(dst) == 0; 1028 bool dst_was_empty = cxCollectionSize(dst) == 0;
1025 1029
1026 CxIterator src_iter = cxListIterator(src); 1030 CxIterator src_iter = cxListIterator(src);
1027 CxIterator other_iter = cxListIterator(other); 1031 CxIterator other_iter = cxListIterator(other);
1028 while (cxIteratorValid(src_iter) || cxIteratorValid(other_iter)) { 1032 while (cxIteratorValid(src_iter) || cxIteratorValid(other_iter)) {
1029 void *src_elem, *other_elem; 1033 void *src_elem = NULL, *other_elem = NULL;
1030 int d; 1034 int d;
1031 if (!cxIteratorValid(src_iter)) { 1035 if (!cxIteratorValid(src_iter)) {
1032 other_elem = cxIteratorCurrent(other_iter); 1036 other_elem = cxIteratorCurrent(other_iter);
1033 d = 1; 1037 d = 1;
1034 } else if (!cxIteratorValid(other_iter)) { 1038 } else if (!cxIteratorValid(other_iter)) {

mercurial