217 |
217 |
218 int cxListCompare( |
218 int cxListCompare( |
219 CxList const *list, |
219 CxList const *list, |
220 CxList const *other |
220 CxList const *other |
221 ) { |
221 ) { |
222 if (list->cl->compare == other->cl->compare) { |
222 if ((list->store_pointer ^ other->store_pointer) || |
223 // same compare function, lists are compatible |
223 ((list->climpl == NULL) ^ (other->climpl != NULL)) || |
224 return list->cl->compare(list, other); |
224 ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) != |
225 } else { |
225 (other->climpl != NULL ? other->climpl->compare : other->cl->compare))) { |
226 // different compare functions, use iterator |
226 // lists are definitely different - cannot use internal compare function |
227 if (list->size == other->size) { |
227 if (list->size == other->size) { |
228 CxIterator left = cxListIterator(list); |
228 CxIterator left = cxListIterator(list); |
229 CxIterator right = cxListIterator(other); |
229 CxIterator right = cxListIterator(other); |
230 for (size_t i = 0; i < list->size; i++) { |
230 for (size_t i = 0; i < list->size; i++) { |
231 void *leftValue = cxIteratorCurrent(left); |
231 void *leftValue = cxIteratorCurrent(left); |