src/cx/kv_list.h

changeset 1605
55b13f583356
parent 1426
3a89b31f0724
--- a/src/cx/kv_list.h	Sun Dec 14 16:21:09 2025 +0100
+++ b/src/cx/kv_list.h	Sun Dec 14 17:30:17 2025 +0100
@@ -49,7 +49,7 @@
  *
  * If @p elem_size is #CX_STORE_POINTERS, the created list stores pointers instead of
  * copies of the added elements, and the compare function will be automatically set
- * to cx_cmp_ptr() if none is given.
+ * to cx_cmp_ptr().
  *
  * After creating the list, it can also be used as a map after converting the pointer
  * to a CxMap pointer with cxKvListAsMap().
@@ -58,9 +58,6 @@
  *
  * @param allocator the allocator for allocating the list nodes
  * (if @c NULL, the cxDefaultAllocator will be used)
- * @param comparator the comparator for the elements
- * (if @c NULL, and the list is not storing pointers, sort and find
- * functions will not work)
  * @param elem_size the size of each element in bytes
  * @return the created list
  * @see cxKvListAsMap()
@@ -68,14 +65,14 @@
  */
 cx_attr_nodiscard cx_attr_malloc cx_attr_dealloc(cxListFree, 1)
 CX_EXPORT CxList *cxKvListCreate(const CxAllocator *allocator,
-        cx_compare_func comparator, size_t elem_size);
+        size_t elem_size);
 
 /**
  * Allocates a linked list with a lookup-map for storing elements with @p elem_size bytes each.
  *
  * If @p elem_size is #CX_STORE_POINTERS, the created list stores pointers instead of
  * copies of the added elements, and the compare function will be automatically set
- * to cx_cmp_ptr() if none is given.
+ * to cx_cmp_ptr().
  *
  * This function creates the list with cxKvListCreate() and immediately applies
  * cxKvListAsMap(). If you want to use the returned object as a list, you can call
@@ -83,9 +80,6 @@
  *
  * @param allocator the allocator for allocating the list nodes
  * (if @c NULL, the cxDefaultAllocator will be used)
- * @param comparator the comparator for the elements
- * (if @c NULL, and the list is not storing pointers, sort and find
- * functions will not work)
  * @param elem_size the size of each element in bytes
  * @return the created list wrapped into the CxMap interface
  * @see cxKvListAsMap()
@@ -93,52 +87,7 @@
  */
 cx_attr_nodiscard cx_attr_malloc cx_attr_dealloc(cxMapFree, 1)
 CX_EXPORT CxMap *cxKvListCreateAsMap(const CxAllocator *allocator,
-        cx_compare_func comparator, size_t elem_size);
-
-/**
- * Allocates a linked list with a lookup-map for storing elements with @p elem_size bytes each.
- *
- * The list will use cxDefaultAllocator and no comparator function. If you want
- * to call functions that need a comparator, you must either set one immediately
- * after list creation or use cxKvListCreate().
- *
- * If @p elem_size is #CX_STORE_POINTERS, the created list stores pointers instead of
- * copies of the added elements, and the compare function will be automatically set
- * to cx_cmp_ptr().
- *
- * After creating the list, it can also be used as a map after converting the pointer
- * to a CxMap pointer with cxKvListAsMap().
- * When you want to use the list interface again, you can also convert the map pointer back
- * with cxKvListAsList().
- *
- * @param elem_size (@c size_t) the size of each element in bytes
- * @return (@c CxList*) the created list
- * @see cxKvListAsMap()
- * @see cxKvListAsList()
- */
-#define cxKvListCreateSimple(elem_size) cxKvListCreate(NULL, NULL, elem_size)
-
-/**
- * Allocates a linked list with a lookup-map for storing elements with @p elem_size bytes each.
- *
- * The list will use cxDefaultAllocator and no comparator function. If you want
- * to call functions that need a comparator, you must either set one immediately
- * after list creation or use cxKvListCreate().
- *
- * If @p elem_size is #CX_STORE_POINTERS, the created list stores pointers instead of
- * copies of the added elements, and the compare function will be automatically set
- * to cx_cmp_ptr().
- *
- * This macro behaves as if the list was created with cxKvListCreateSimple() and
- * immediately followed up by cxKvListAsMap().
- * If you want to use the returned object as a list, you can call cxKvListAsList() later.
- *
- * @param elem_size (@c size_t) the size of each element in bytes
- * @return (@c CxMap*) the created list wrapped into the CxMap interface
- * @see cxKvListAsMap()
- * @see cxKvListAsList()
- */
-#define cxKvListCreateAsMapSimple(elem_size) cxKvListCreateAsMap(NULL, NULL, elem_size)
+        size_t elem_size);
 
 /**
  * Converts a map pointer belonging to a key-value-List back to the original list pointer.
@@ -152,7 +101,7 @@
 /**
  * Converts a map pointer belonging to a key-value-List back to the original list pointer.
  *
- * @param list a list created by cxKvListCreate() or cxKvListCreateSimple()
+ * @param list a list created by cxKvListCreate()
  * @return a map pointer that lets you use the list as if it was a map
  */
 cx_attr_nodiscard cx_attr_nonnull cx_attr_returns_nonnull

mercurial