diff -r cf19b7820ff0 -r 94360453bce4 src/cx/string.h --- a/src/cx/string.h Thu Dec 25 12:07:37 2025 +0100 +++ b/src/cx/string.h Sun Dec 28 14:10:14 2025 +0100 @@ -41,6 +41,9 @@ #include +/** Convenience macro for creating a null string */ +#define CX_NULLSTR cx_mutstr(NULL) + /** Expands a UCX string as printf arguments. */ #define CX_SFMT(s) (int) (s).length, (s).ptr @@ -419,17 +422,17 @@ * @note It is guaranteed that there is only one allocation for the * resulting string. * It is also guaranteed that the returned string is zero-terminated. + * If allocation fails, the @c ptr in the returned string will be @c NULL. * * @param alloc the allocator to use * @param str the string the other strings shall be concatenated to * @param count the number of the other following strings to concatenate * @param ... all other UCX strings - * @retval zero success - * @retval non-zero allocation failure + * @return the concatenated string */ cx_attr_nonnull -CX_EXPORT int cx_strcat_a(const CxAllocator *alloc, - cxmutstr *str, size_t count, ...); +CX_EXPORT cxmutstr cx_strcat_a(const CxAllocator *alloc, + cxmutstr str, size_t count, ...); /** * Concatenates strings and returns a new string. @@ -440,12 +443,12 @@ * @note It is guaranteed that there is only one allocation for the * resulting string. * It is also guaranteed that the returned string is zero-terminated. + * If allocation fails, the @c ptr in the returned string will be @c NULL. * * @param str (@c cxmutstr*) the string the other strings shall be concatenated to * @param count (@c size_t) the number of the other following strings to concatenate * @param ... all other UCX strings - * @retval zero success - * @retval non-zero allocation failure + * @return the concatenated string */ #define cx_strcat(str, count, ...) \ cx_strcat_a(cxDefaultAllocator, str, count, __VA_ARGS__)