fix cxListCompare if-condition

Sun, 21 May 2023 14:04:34 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 21 May 2023 14:04:34 +0200
changeset 705
0d5447230044
parent 704
35f06c5eeb0e
child 706
8c6edaccaef1

fix cxListCompare if-condition

src/list.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/list.c	Sun May 21 14:03:21 2023 +0200
     1.2 +++ b/src/list.c	Sun May 21 14:04:34 2023 +0200
     1.3 @@ -298,10 +298,17 @@
     1.4          CxList const *list,
     1.5          CxList const *other
     1.6  ) {
     1.7 -    if ((list->store_pointer ^ other->store_pointer) ||
     1.8 -        ((list->climpl == NULL) ^ (other->climpl != NULL)) ||
     1.9 +    if (
    1.10 +        // if one is storing pointers but the other is not
    1.11 +        (list->store_pointer ^ other->store_pointer) ||
    1.12 +
    1.13 +        // if one class is wrapped but the other is not
    1.14 +        ((list->climpl == NULL) ^ (other->climpl == NULL)) ||
    1.15 +
    1.16 +        // if the resolved compare functions are not the same
    1.17          ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) !=
    1.18 -         (other->climpl != NULL ? other->climpl->compare : other->cl->compare))) {
    1.19 +         (other->climpl != NULL ? other->climpl->compare : other->cl->compare))
    1.20 +    ) {
    1.21          // lists are definitely different - cannot use internal compare function
    1.22          if (list->size == other->size) {
    1.23              CxIterator left = cxListIterator(list);

mercurial