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
--- a/src/list.c	Sun May 21 14:03:21 2023 +0200
+++ b/src/list.c	Sun May 21 14:04:34 2023 +0200
@@ -298,10 +298,17 @@
         CxList const *list,
         CxList const *other
 ) {
-    if ((list->store_pointer ^ other->store_pointer) ||
-        ((list->climpl == NULL) ^ (other->climpl != NULL)) ||
+    if (
+        // if one is storing pointers but the other is not
+        (list->store_pointer ^ other->store_pointer) ||
+
+        // if one class is wrapped but the other is not
+        ((list->climpl == NULL) ^ (other->climpl == NULL)) ||
+
+        // if the resolved compare functions are not the same
         ((list->climpl != NULL ? list->climpl->compare : list->cl->compare) !=
-         (other->climpl != NULL ? other->climpl->compare : other->cl->compare))) {
+         (other->climpl != NULL ? other->climpl->compare : other->cl->compare))
+    ) {
         // lists are definitely different - cannot use internal compare function
         if (list->size == other->size) {
             CxIterator left = cxListIterator(list);

mercurial