src/cx/string.h

changeset 1644
bbe3199e37fc
parent 1582
32b82c424252
--- a/src/cx/string.h	Sat Dec 20 11:11:58 2025 +0100
+++ b/src/cx/string.h	Sun Dec 21 11:09:46 2025 +0100
@@ -348,10 +348,7 @@
 /**
  * Copies a string.
  *
- * The memory in the @p dest structure is either allocated or re-allocated to fit the entire
- * source string, including a zero-terminator.
- *
- * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is.
+ * Internal function - do not use.
  *
  * @param alloc the allocator
  * @param dest a pointer to the structure where to copy the contents to
@@ -359,10 +356,26 @@
  *
  * @retval zero success
  * @retval non-zero if re-allocation failed
+ * @see cx_strcpy_a()
  */
 cx_attr_nonnull_arg(1)
-CX_EXPORT int cx_strcpy_a(const CxAllocator *alloc, cxmutstr *dest, cxstring src);
+CX_EXPORT int cx_strcpy_a_(const CxAllocator *alloc, cxmutstr *dest, cxstring src);
 
+/**
+ * Copies a string.
+ *
+ * The memory in the @p dest structure is either allocated or re-allocated to fit the entire
+ * source string, including a zero-terminator.
+ *
+ * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is.
+ *
+ * @param alloc (@c CxAllocator*) the allocator
+ * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to
+ * @param src the source string
+ * @retval zero success
+ * @retval non-zero if re-allocation failed
+ */
+#define cx_strcpy_a(alloc, dest, src) cx_strcpy_a_(alloc, dest, cx_strcast(src))
 
 /**
  * Copies a string.
@@ -373,8 +386,7 @@
  * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is.
  *
  * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to
- * @param src (@c cxstring) the source string
- *
+ * @param src the source string
  * @retval zero success
  * @retval non-zero if re-allocation failed
  */

mercurial