src/list.c

changeset 680
19379743e5a0
parent 677
b09aae58bba4
child 699
35b2b99ee523
     1.1 --- a/src/list.c	Sun Apr 09 19:37:00 2023 +0200
     1.2 +++ b/src/list.c	Sun Apr 09 20:00:44 2023 +0200
     1.3 @@ -219,11 +219,11 @@
     1.4          CxList const *list,
     1.5          CxList const *other
     1.6  ) {
     1.7 -    if (list->cl->compare == other->cl->compare) {
     1.8 -        // same compare function, lists are compatible
     1.9 -        return list->cl->compare(list, other);
    1.10 -    } else {
    1.11 -        // different compare functions, use iterator
    1.12 +    if ((list->store_pointer ^ other->store_pointer) ||
    1.13 +        ((list->climpl == NULL) ^ (other->climpl != NULL)) ||
    1.14 +        ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) !=
    1.15 +         (other->climpl != NULL ? other->climpl->compare : other->cl->compare))) {
    1.16 +        // lists are definitely different - cannot use internal compare function
    1.17          if (list->size == other->size) {
    1.18              CxIterator left = cxListIterator(list);
    1.19              CxIterator right = cxListIterator(other);
    1.20 @@ -241,6 +241,9 @@
    1.21          } else {
    1.22              return list->size < other->size ? -1 : 1;
    1.23          }
    1.24 +    } else {
    1.25 +        // lists are compatible
    1.26 +        return list->cl->compare(list, other);
    1.27      }
    1.28  }
    1.29  

mercurial