make cxCollectionSorted() always return true for empty collections regardless of the sorted flag

Fri, 17 Oct 2025 14:14:21 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 17 Oct 2025 14:14:21 +0200
changeset 1427
943bfd9e7978
parent 1426
3a89b31f0724
child 1428
0ac4aa1737fd

make cxCollectionSorted() always return true for empty collections regardless of the sorted flag

src/cx/collection.h file | annotate | diff | comparison | revisions
--- a/src/cx/collection.h	Thu Oct 16 19:57:47 2025 +0200
+++ b/src/cx/collection.h	Fri Oct 17 14:14:21 2025 +0200
@@ -151,7 +151,7 @@
  * @retval true if the elements are currently sorted wrt. the collection's compare function
  * @retval false if the order of elements is unknown
  */
-#define cxCollectionSorted(c) ((c)->collection.sorted)
+#define cxCollectionSorted(c) ((c)->collection.sorted || (c)->collection.size == 0)
 
 /**
  * Sets a simple destructor function for this collection.

mercurial