src/cx/array_list.h

changeset 1426
3a89b31f0724
parent 1425
83284b289430
--- a/src/cx/array_list.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/array_list.h	Thu Oct 16 19:57:47 2025 +0200
@@ -47,8 +47,7 @@
  * The maximum item size in an array list that fits into
  * a stack buffer when swapped.
  */
-cx_attr_export
-extern const unsigned cx_array_swap_sbo_size;
+CX_EXPORT extern const unsigned cx_array_swap_sbo_size;
 
 /**
  * Declares variables for an array that can be used with the convenience macros.
@@ -183,16 +182,8 @@
      * @param alloc a reference to this allocator
      * @return a pointer to the reallocated memory or @c NULL on failure
      */
-    cx_attr_nodiscard
-    cx_attr_nonnull_arg(5)
-    cx_attr_allocsize(3, 4)
-    void *(*realloc)(
-            void *array,
-            size_t old_capacity,
-            size_t new_capacity,
-            size_t elem_size,
-            struct cx_array_reallocator_s *alloc
-    );
+    void *(*realloc)( void *array, size_t old_capacity, size_t new_capacity,
+            size_t elem_size, struct cx_array_reallocator_s *alloc);
 
     /**
      * The allocator that shall be used for the reallocations.
@@ -213,8 +204,7 @@
 /**
  * A default array reallocator that is based on the cxDefaultAllocator.
  */
-cx_attr_export
-extern CxArrayReallocator *cx_array_default_reallocator;
+CX_EXPORT extern CxArrayReallocator *cx_array_default_reallocator;
 
 /**
  * Creates a new array reallocator.
@@ -234,11 +224,8 @@
  * on the stack or shall not reallocate in place
  * @return an array reallocator
  */
-cx_attr_export
-CxArrayReallocator cx_array_reallocator(
-        const struct cx_allocator_s *allocator,
-        const void *stack_ptr
-);
+CX_EXPORT CxArrayReallocator cx_array_reallocator(
+        const struct cx_allocator_s *allocator, const void *stack_ptr);
 
 /**
  * Reserves memory for additional elements.
@@ -271,16 +258,9 @@
  * @see cx_array_reallocator()
  */
 cx_attr_nonnull_arg(1, 2, 3)
-cx_attr_export
-int cx_array_reserve(
-        void **array,
-        void *size,
-        void *capacity,
-        unsigned width,
-        size_t elem_size,
-        size_t elem_count,
-        CxArrayReallocator *reallocator
-);
+CX_EXPORT int cx_array_reserve(void **array, void *size, void *capacity,
+        unsigned width, size_t elem_size, size_t elem_count,
+        CxArrayReallocator *reallocator);
 
 /**
  * Copies elements from one array to another.
@@ -315,18 +295,9 @@
  * @see cx_array_reallocator()
  */
 cx_attr_nonnull_arg(1, 2, 3, 6)
-cx_attr_export
-int cx_array_copy(
-        void **target,
-        void *size,
-        void *capacity,
-        unsigned width,
-        size_t index,
-        const void *src,
-        size_t elem_size,
-        size_t elem_count,
-        CxArrayReallocator *reallocator
-);
+CX_EXPORT int cx_array_copy(void **target, void *size, void *capacity, unsigned width,
+        size_t index, const void *src, size_t elem_size, size_t elem_count,
+        CxArrayReallocator *reallocator);
 
 /**
  * Convenience macro that uses cx_array_copy() with a default layout and
@@ -474,17 +445,9 @@
  * @retval non-zero failure
  */
 cx_attr_nonnull_arg(1, 2, 3, 5)
-cx_attr_export
-int cx_array_insert_sorted(
-        void **target,
-        size_t *size,
-        size_t *capacity,
-        cx_compare_func cmp_func,
-        const void *src,
-        size_t elem_size,
-        size_t elem_count,
-        CxArrayReallocator *reallocator
-);
+CX_EXPORT int cx_array_insert_sorted(void **target, size_t *size, size_t *capacity,
+        cx_compare_func cmp_func, const void *src, size_t elem_size, size_t elem_count,
+        CxArrayReallocator *reallocator);
 
 /**
  * Inserts an element into a sorted array.
@@ -492,7 +455,7 @@
  * If the target array is not already sorted with respect
  * to the specified @p cmp_func, the behavior is undefined.
  *
- * If the capacity is insufficient to hold the new data, a reallocation
+ * If the capacity is not enough to hold the new data, a reallocation
  * attempt is made.
  *
  * The \@ SIZE_TYPE is flexible and can be any unsigned integer type.
@@ -603,17 +566,9 @@
  * @retval non-zero failure
  */
 cx_attr_nonnull_arg(1, 2, 3, 5)
-cx_attr_export
-int cx_array_insert_unique(
-        void **target,
-        size_t *size,
-        size_t *capacity,
-        cx_compare_func cmp_func,
-        const void *src,
-        size_t elem_size,
-        size_t elem_count,
-        CxArrayReallocator *reallocator
-);
+CX_EXPORT int cx_array_insert_unique(void **target, size_t *size, size_t *capacity,
+        cx_compare_func cmp_func, const void *src, size_t elem_size, size_t elem_count,
+        CxArrayReallocator *reallocator);
 
 /**
  * Inserts an element into a sorted array if it does not exist.
@@ -730,14 +685,8 @@
  * @see cx_array_binary_search()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cx_array_binary_search_inf(
-        const void *arr,
-        size_t size,
-        size_t elem_size,
-        const void *elem,
-        cx_compare_func cmp_func
-);
+CX_EXPORT size_t cx_array_binary_search_inf(const void *arr, size_t size,
+        size_t elem_size, const void *elem, cx_compare_func cmp_func);
 
 /**
  * Searches an item in a sorted array.
@@ -756,14 +705,8 @@
  * @see cx_array_binary_search_sup()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cx_array_binary_search(
-        const void *arr,
-        size_t size,
-        size_t elem_size,
-        const void *elem,
-        cx_compare_func cmp_func
-);
+CX_EXPORT size_t cx_array_binary_search(const void *arr, size_t size,
+        size_t elem_size, const void *elem, cx_compare_func cmp_func);
 
 /**
  * Searches the smallest upper bound in a sorted array.
@@ -788,14 +731,8 @@
  * @see cx_array_binary_search()
  */
 cx_attr_nonnull
-cx_attr_export
-size_t cx_array_binary_search_sup(
-        const void *arr,
-        size_t size,
-        size_t elem_size,
-        const void *elem,
-        cx_compare_func cmp_func
-);
+CX_EXPORT size_t cx_array_binary_search_sup(const void *arr, size_t size,
+        size_t elem_size, const void *elem, cx_compare_func cmp_func);
 
 /**
  * Swaps two array elements.
@@ -806,13 +743,7 @@
  * @param idx2 index of the second element
  */
 cx_attr_nonnull
-cx_attr_export
-void cx_array_swap(
-        void *arr,
-        size_t elem_size,
-        size_t idx1,
-        size_t idx2
-);
+CX_EXPORT void cx_array_swap(void *arr, size_t elem_size, size_t idx1, size_t idx2);
 
 /**
  * Allocates an array list for storing elements with @p elem_size bytes each.
@@ -833,13 +764,8 @@
 cx_attr_nodiscard
 cx_attr_malloc
 cx_attr_dealloc(cxListFree, 1)
-cx_attr_export
-CxList *cxArrayListCreate(
-        const CxAllocator *allocator,
-        cx_compare_func comparator,
-        size_t elem_size,
-        size_t initial_capacity
-);
+CX_EXPORT CxList *cxArrayListCreate(const CxAllocator *allocator,
+        cx_compare_func comparator, size_t elem_size, size_t initial_capacity);
 
 /**
  * Allocates an array list for storing elements with @p elem_size bytes each.

mercurial