src/list.c

changeset 705
0d5447230044
parent 704
35f06c5eeb0e
child 708
1caed6c9ba68
equal deleted inserted replaced
704:35f06c5eeb0e 705:0d5447230044
296 296
297 int cxListCompare( 297 int cxListCompare(
298 CxList const *list, 298 CxList const *list,
299 CxList const *other 299 CxList const *other
300 ) { 300 ) {
301 if ((list->store_pointer ^ other->store_pointer) || 301 if (
302 ((list->climpl == NULL) ^ (other->climpl != NULL)) || 302 // if one is storing pointers but the other is not
303 (list->store_pointer ^ other->store_pointer) ||
304
305 // if one class is wrapped but the other is not
306 ((list->climpl == NULL) ^ (other->climpl == NULL)) ||
307
308 // if the resolved compare functions are not the same
303 ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) != 309 ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) !=
304 (other->climpl != NULL ? other->climpl->compare : other->cl->compare))) { 310 (other->climpl != NULL ? other->climpl->compare : other->cl->compare))
311 ) {
305 // lists are definitely different - cannot use internal compare function 312 // lists are definitely different - cannot use internal compare function
306 if (list->size == other->size) { 313 if (list->size == other->size) {
307 CxIterator left = cxListIterator(list); 314 CxIterator left = cxListIterator(list);
308 CxIterator right = cxListIterator(other); 315 CxIterator right = cxListIterator(other);
309 for (size_t i = 0; i < list->size; i++) { 316 for (size_t i = 0; i < list->size; i++) {

mercurial