src/cx/string.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
--- a/src/cx/string.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/string.h	Thu Oct 16 19:57:47 2025 +0200
@@ -48,8 +48,7 @@
 /**
  * The maximum length of the "needle" in cx_strstr() that can use SBO.
  */
-cx_attr_export
-extern const unsigned cx_strstr_sbo_size;
+CX_EXPORT extern const unsigned cx_strstr_sbo_size;
 
 /**
  * The UCX string structure.
@@ -179,10 +178,8 @@
  *
  * @see cx_mutstrn()
  */
-cx_attr_nodiscard
-cx_attr_cstr_arg(1)
-cx_attr_export
-cxmutstr cx_mutstr(char *cstring);
+cx_attr_nodiscard cx_attr_cstr_arg(1)
+CX_EXPORT cxmutstr cx_mutstr(char *cstring);
 
 /**
  * Wraps a string that does not need to be zero-terminated.
@@ -200,13 +197,8 @@
  *
  * @see cx_mutstr()
  */
-cx_attr_nodiscard
-cx_attr_access_rw(1, 2)
-cx_attr_export
-cxmutstr cx_mutstrn(
-        char *cstring,
-        size_t length
-);
+cx_attr_nodiscard cx_attr_access_rw(1, 2)
+CX_EXPORT cxmutstr cx_mutstrn(char *cstring, size_t length);
 
 /**
  * Wraps a string that must be zero-terminated.
@@ -225,10 +217,8 @@
  *
  * @see cx_strn()
  */
-cx_attr_nodiscard
-cx_attr_cstr_arg(1)
-cx_attr_export
-cxstring cx_str(const char *cstring);
+cx_attr_nodiscard cx_attr_cstr_arg(1)
+CX_EXPORT cxstring cx_str(const char *cstring);
 
 
 /**
@@ -247,28 +237,27 @@
  *
  * @see cx_str()
  */
-cx_attr_nodiscard
-cx_attr_access_r(1, 2)
-cx_attr_export
-cxstring cx_strn(
-        const char *cstring,
-        size_t length
-);
+cx_attr_nodiscard cx_attr_access_r(1, 2)
+CX_EXPORT cxstring cx_strn(const char *cstring, size_t length);
 
 #ifdef __cplusplus
 } // extern "C"
 cx_attr_nodiscard
-static inline cxstring cx_strcast(cxmutstr str) {
+CX_CPPDECL cxstring cx_strcast(cxmutstr str) {
     return cx_strn(str.ptr, str.length);
 }
 cx_attr_nodiscard
-static inline cxstring cx_strcast(cxstring str) {
+CX_CPPDECL cxstring cx_strcast(cxstring str) {
     return str;
 }
 cx_attr_nodiscard
-static inline cxstring cx_strcast(const char *str) {
+CX_CPPDECL cxstring cx_strcast(const char *str) {
     return cx_str(str);
 }
+cx_attr_nodiscard
+CX_CPPDECL cxstring cx_strcast(const unsigned char *str) {
+    return cx_str(static_cast<const char*>(str));
+}
 extern "C" {
 #else
 /**
@@ -278,7 +267,7 @@
  * @see cx_strcast()
  */
 cx_attr_nodiscard
-static inline cxstring cx_strcast_m(cxmutstr str) {
+CX_INLINE cxstring cx_strcast_m(cxmutstr str) {
     return (cxstring) {str.ptr, str.length};
 }
 /**
@@ -288,7 +277,7 @@
  * @see cx_strcast()
  */
 cx_attr_nodiscard
-static inline cxstring cx_strcast_c(cxstring str) {
+CX_INLINE cxstring cx_strcast_c(cxstring str) {
     return str;
 }
 
@@ -299,7 +288,18 @@
  * @see cx_strcast()
  */
 cx_attr_nodiscard
-static inline cxstring cx_strcast_z(const char *str) {
+CX_INLINE cxstring cx_strcast_u(const unsigned char *str) {
+    return cx_str((const char*)str);
+}
+
+/**
+ * Internal function, do not use.
+ * @param str
+ * @return
+ * @see cx_strcast()
+ */
+cx_attr_nodiscard
+CX_INLINE cxstring cx_strcast_z(const char *str) {
     return cx_str(str);
 }
 
@@ -312,8 +312,8 @@
 #define cx_strcast(str) _Generic((str), \
         cxmutstr: cx_strcast_m, \
         cxstring: cx_strcast_c, \
-        const unsigned char*: cx_strcast_z, \
-        unsigned char *: cx_strcast_z, \
+        const unsigned char*: cx_strcast_u, \
+        unsigned char *: cx_strcast_u, \
         const char*: cx_strcast_z, \
         char *: cx_strcast_z) (str)
 #endif
@@ -330,8 +330,7 @@
  *
  * @param str the string to free
  */
-cx_attr_export
-void cx_strfree(cxmutstr *str);
+CX_EXPORT void cx_strfree(cxmutstr *str);
 
 /**
  * Passes the pointer in this string to the allocator's free function.
@@ -347,11 +346,7 @@
  * @param str the string to free
  */
 cx_attr_nonnull_arg(1)
-cx_attr_export
-void cx_strfree_a(
-        const CxAllocator *alloc,
-        cxmutstr *str
-);
+CX_EXPORT void cx_strfree_a(const CxAllocator *alloc, cxmutstr *str);
 
 /**
  * Copies a string.
@@ -369,12 +364,7 @@
  * @retval non-zero if re-allocation failed
  */
 cx_attr_nonnull_arg(1)
-cx_attr_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);
 
 
 /**
@@ -406,11 +396,7 @@
  * @return the accumulated length of all strings
  */
 cx_attr_nodiscard
-cx_attr_export
-size_t cx_strlen(
-        size_t count,
-        ...
-);
+CX_EXPORT size_t cx_strlen(size_t count, ...);
 
 /**
  * Concatenates strings.
@@ -434,15 +420,9 @@
  * @param ...   all other UCX strings
  * @return the concatenated string
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_export
-cxmutstr cx_strcat_ma(
-        const CxAllocator *alloc,
-        cxmutstr str,
-        size_t count,
-        ...
-);
+cx_attr_nodiscard cx_attr_nonnull
+CX_EXPORT cxmutstr cx_strcat_ma(const CxAllocator *alloc,
+        cxmutstr str, size_t count, ...);
 
 /**
  * Concatenates strings and returns a new string.
@@ -463,7 +443,7 @@
  * @return (@c cxmutstr) the concatenated string
  */
 #define cx_strcat_a(alloc, count, ...) \
-cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
+        cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
 
 /**
  * Concatenates strings and returns a new string.
@@ -483,7 +463,7 @@
  * @return (@c cxmutstr) the concatenated string
  */
 #define cx_strcat(count, ...) \
-cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
+        cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__)
 
 /**
  * Concatenates strings.
@@ -507,7 +487,7 @@
  * @return (@c cxmutstr) the concatenated string
  */
 #define cx_strcat_m(str, count, ...) \
-cx_strcat_ma(cxDefaultAllocator, str, count, __VA_ARGS__)
+        cx_strcat_ma(cxDefaultAllocator, str, count, __VA_ARGS__)
 
 /**
  * Returns a substring starting at the specified location.
@@ -525,11 +505,7 @@
  * @see cx_strsubsl_m()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strsubs(
-        cxstring string,
-        size_t start
-);
+CX_EXPORT cxstring cx_strsubs(cxstring string, size_t start);
 
 /**
  * Returns a substring starting at the specified location.
@@ -551,12 +527,7 @@
  * @see cx_strsubsl_m()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strsubsl(
-        cxstring string,
-        size_t start,
-        size_t length
-);
+CX_EXPORT cxstring cx_strsubsl(cxstring string, size_t start, size_t length);
 
 /**
  * Returns a substring starting at the specified location.
@@ -574,11 +545,7 @@
  * @see cx_strsubsl()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strsubs_m(
-        cxmutstr string,
-        size_t start
-);
+CX_EXPORT cxmutstr cx_strsubs_m(cxmutstr string, size_t start);
 
 /**
  * Returns a substring starting at the specified location.
@@ -600,12 +567,7 @@
  * @see cx_strsubsl()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strsubsl_m(
-        cxmutstr string,
-        size_t start,
-        size_t length
-);
+CX_EXPORT cxmutstr cx_strsubsl_m(cxmutstr string, size_t start, size_t length);
 
 /**
  * Returns a substring starting at the location of the first occurrence of the
@@ -620,11 +582,7 @@
  * @see cx_strchr_m()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strchr(
-        cxstring string,
-        int chr
-);
+CX_EXPORT cxstring cx_strchr(cxstring string, int chr);
 
 /**
  * Returns a substring starting at the location of the first occurrence of the
@@ -639,11 +597,7 @@
  * @see cx_strchr()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strchr_m(
-        cxmutstr string,
-        int chr
-);
+CX_EXPORT cxmutstr cx_strchr_m(cxmutstr string, int chr);
 
 /**
  * Returns a substring starting at the location of the last occurrence of the
@@ -658,11 +612,7 @@
  * @see cx_strrchr_m()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strrchr(
-        cxstring string,
-        int chr
-);
+CX_EXPORT cxstring cx_strrchr(cxstring string, int chr);
 
 /**
  * Returns a substring starting at the location of the last occurrence of the
@@ -677,11 +627,7 @@
  * @see cx_strrchr()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strrchr_m(
-        cxmutstr string,
-        int chr
-);
+CX_EXPORT cxmutstr cx_strrchr_m(cxmutstr string, int chr);
 
 /**
  * Returns a substring starting at the location of the first occurrence of the
@@ -700,11 +646,7 @@
  * @see cx_strstr_m()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strstr(
-        cxstring haystack,
-        cxstring needle
-);
+CX_EXPORT cxstring cx_strstr(cxstring haystack, cxstring needle);
 
 /**
  * Returns a substring starting at the location of the first occurrence of the
@@ -723,11 +665,7 @@
  * @see cx_strstr()
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strstr_m(
-        cxmutstr haystack,
-        cxstring needle
-);
+CX_EXPORT cxmutstr cx_strstr_m(cxmutstr haystack, cxstring needle);
 
 /**
  * Splits a given string using a delimiter string.
@@ -741,16 +679,9 @@
  * @param output a preallocated array of at least @p limit length
  * @return the actual number of split items
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_access_w(4, 3)
-cx_attr_export
-size_t cx_strsplit(
-        cxstring string,
-        cxstring delim,
-        size_t limit,
-        cxstring *output
-);
+cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(4, 3)
+CX_EXPORT size_t cx_strsplit(cxstring string, cxstring delim,
+        size_t limit, cxstring *output);
 
 /**
  * Splits a given string using a delimiter string.
@@ -771,17 +702,10 @@
  * written to
  * @return the actual number of split items
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_access_w(5)
-cx_attr_export
-size_t cx_strsplit_a(
-        const CxAllocator *allocator,
-        cxstring string,
-        cxstring delim,
-        size_t limit,
-        cxstring **output
-);
+cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(5)
+CX_EXPORT size_t cx_strsplit_a(const CxAllocator *allocator,
+        cxstring string, cxstring delim,
+        size_t limit, cxstring **output);
 
 
 /**
@@ -796,16 +720,9 @@
  * @param output a preallocated array of at least @p limit length
  * @return the actual number of split items
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_access_w(4, 3)
-cx_attr_export
-size_t cx_strsplit_m(
-        cxmutstr string,
-        cxstring delim,
-        size_t limit,
-        cxmutstr *output
-);
+cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(4, 3)
+CX_EXPORT size_t cx_strsplit_m(cxmutstr string, cxstring delim,
+        size_t limit, cxmutstr *output);
 
 /**
  * Splits a given string using a delimiter string.
@@ -826,17 +743,10 @@
  * written to
  * @return the actual number of split items
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_access_w(5)
-cx_attr_export
-size_t cx_strsplit_ma(
-        const CxAllocator *allocator,
-        cxmutstr string,
-        cxstring delim,
-        size_t limit,
-        cxmutstr **output
-);
+cx_attr_nodiscard cx_attr_nonnull cx_attr_access_w(5)
+CX_EXPORT size_t cx_strsplit_ma(const CxAllocator *allocator,
+        cxmutstr string, cxstring delim, size_t limit,
+        cxmutstr **output);
 
 /**
  * Compares two strings.
@@ -847,11 +757,17 @@
  * than @p s2, zero if both strings equal
  */
 cx_attr_nodiscard
-cx_attr_export
-int cx_strcmp(
-        cxstring s1,
-        cxstring s2
-);
+CX_EXPORT int cx_strcmp_(cxstring s1, cxstring s2);
+
+/**
+ * Compares two strings.
+ *
+ * @param s1 the first string
+ * @param s2 the second string
+ * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
+ * than @p s2, zero if both strings equal
+ */
+#define cx_strcmp(s1, s2) cx_strcmp_(cx_strcast(s1), cx_strcast(s2))
 
 /**
  * Compares two strings ignoring case.
@@ -862,29 +778,33 @@
  * than @p s2, zero if both strings equal ignoring case
  */
 cx_attr_nodiscard
-cx_attr_export
-int cx_strcasecmp(
-        cxstring s1,
-        cxstring s2
-);
+CX_EXPORT int cx_strcasecmp_(cxstring s1, cxstring s2);
+
+/**
+ * Compares two strings ignoring case.
+ *
+ * @param s1 the first string
+ * @param s2 the second string
+ * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
+ * than @p s2, zero if both strings equal ignoring case
+ */
+#define cx_strcasecmp(s1, s2) cx_strcasecmp_(cx_strcast(s1), cx_strcast(s2))
 
 /**
  * Compares two strings.
  *
  * This function has a compatible signature for the use as a cx_compare_func.
  *
+ * @attention This function can @em only compare UCX strings. It is unsafe to
+ * pass normal C-strings to this function.
+ *
  * @param s1 the first string
  * @param s2 the second string
  * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
  * than @p s2, zero if both strings equal
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_export
-int cx_strcmp_p(
-        const void *s1,
-        const void *s2
-);
+cx_attr_nodiscard  cx_attr_nonnull
+CX_EXPORT int cx_strcmp_p(const void *s1, const void *s2);
 
 /**
  * Compares two strings ignoring case.
@@ -896,13 +816,8 @@
  * @return negative if @p s1 is smaller than @p s2, positive if @p s1 is larger
  * than @p s2, zero if both strings equal ignoring case
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_export
-int cx_strcasecmp_p(
-        const void *s1,
-        const void *s2
-);
+cx_attr_nodiscard cx_attr_nonnull
+CX_EXPORT int cx_strcasecmp_p(const void *s1, const void *s2);
 
 
 /**
@@ -917,13 +832,8 @@
  * @return a duplicate of the string
  * @see cx_strdup()
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_export
-cxmutstr cx_strdup_a_(
-        const CxAllocator *allocator,
-        cxstring string
-);
+cx_attr_nodiscard cx_attr_nonnull
+CX_EXPORT cxmutstr cx_strdup_a_(const CxAllocator *allocator, cxstring string);
 
 /**
  * Creates a duplicate of the specified string.
@@ -938,8 +848,7 @@
  * @see cx_strdup()
  * @see cx_strfree_a()
  */
-#define cx_strdup_a(allocator, string) \
-    cx_strdup_a_((allocator), cx_strcast(string))
+#define cx_strdup_a(allocator, string) cx_strdup_a_((allocator), cx_strcast(string))
 
 /**
  * Creates a duplicate of the specified string.
@@ -966,8 +875,7 @@
  * @return the trimmed string
  */
 cx_attr_nodiscard
-cx_attr_export
-cxstring cx_strtrim(cxstring string);
+CX_EXPORT cxstring cx_strtrim(cxstring string);
 
 /**
  * Omits leading and trailing spaces.
@@ -979,8 +887,7 @@
  * @return the trimmed string
  */
 cx_attr_nodiscard
-cx_attr_export
-cxmutstr cx_strtrim_m(cxmutstr string);
+CX_EXPORT cxmutstr cx_strtrim_m(cxmutstr string);
 
 /**
  * Checks if a string has a specific prefix.
@@ -991,11 +898,17 @@
  * @c false otherwise
  */
 cx_attr_nodiscard
-cx_attr_export
-bool cx_strprefix(
-        cxstring string,
-        cxstring prefix
-);
+CX_EXPORT bool cx_strprefix_(cxstring string, cxstring prefix);
+
+/**
+ * Checks if a string has a specific prefix.
+ *
+ * @param string the string to check
+ * @param prefix the prefix the string should have
+ * @return @c true, if and only if the string has the specified prefix,
+ * @c false otherwise
+ */
+#define cx_strprefix(string, prefix) cx_strprefix_(cx_strcast(string), cx_strcast(prefix))
 
 /**
  * Checks if a string has a specific suffix.
@@ -1006,11 +919,17 @@
  * @c false otherwise
  */
 cx_attr_nodiscard
-cx_attr_export
-bool cx_strsuffix(
-        cxstring string,
-        cxstring suffix
-);
+CX_EXPORT bool cx_strsuffix_(cxstring string, cxstring suffix);
+
+/**
+ * Checks if a string has a specific suffix.
+ *
+ * @param string the string to check
+ * @param suffix the suffix the string should have
+ * @return @c true, if and only if the string has the specified suffix,
+ * @c false otherwise
+ */
+#define cx_strsuffix(string, suffix) cx_strsuffix_(cx_strcast(string), cx_strcast(suffix))
 
 /**
  * Checks if a string has a specific prefix, ignoring the case.
@@ -1021,11 +940,17 @@
  * @c false otherwise
  */
 cx_attr_nodiscard
-cx_attr_export
-bool cx_strcaseprefix(
-        cxstring string,
-        cxstring prefix
-);
+CX_EXPORT bool cx_strcaseprefix_(cxstring string, cxstring prefix);
+
+/**
+ * Checks if a string has a specific prefix, ignoring the case.
+ *
+ * @param string the string to check
+ * @param prefix the prefix the string should have
+ * @return @c true, if and only if the string has the specified prefix,
+ * @c false otherwise
+ */
+#define cx_strcaseprefix(string, prefix) cx_strcaseprefix_(cx_strcast(string), cx_strcast(prefix))
 
 /**
  * Checks, if a string has a specific suffix, ignoring the case.
@@ -1036,11 +961,17 @@
  * @c false otherwise
  */
 cx_attr_nodiscard
-cx_attr_export
-bool cx_strcasesuffix(
-        cxstring string,
-        cxstring suffix
-);
+CX_EXPORT bool cx_strcasesuffix_(cxstring string, cxstring suffix);
+
+/**
+ * Checks, if a string has a specific suffix, ignoring the case.
+ *
+ * @param string the string to check
+ * @param suffix the suffix the string should have
+ * @return @c true, if and only if the string has the specified suffix,
+ * @c false otherwise
+ */
+#define cx_strcasesuffix(string, suffix) cx_strcasesuffix_(cx_strcast(string), cx_strcast(suffix))
 
 /**
  * Replaces a string with another string.
@@ -1060,16 +991,9 @@
  * @param replmax maximum number of replacements
  * @return the resulting string after applying the replacements
  */
-cx_attr_nodiscard
-cx_attr_nonnull
-cx_attr_export
-cxmutstr cx_strreplacen_a(
-        const CxAllocator *allocator,
-        cxstring str,
-        cxstring search,
-        cxstring replacement,
-        size_t replmax
-);
+cx_attr_nodiscard cx_attr_nonnull
+CX_EXPORT cxmutstr cx_strreplacen_a(const CxAllocator *allocator,
+        cxstring str, cxstring search, cxstring replacement, size_t replmax);
 
 /**
  * Replaces a string with another string.
@@ -1089,7 +1013,7 @@
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
 #define cx_strreplacen(str, search, replacement, replmax) \
-cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax)
+        cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, replmax)
 
 /**
  * Replaces a string with another string.
@@ -1107,7 +1031,7 @@
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
 #define cx_strreplace_a(allocator, str, search, replacement) \
-cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX)
+        cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX)
 
 /**
  * Replaces a string with another string.
@@ -1124,7 +1048,7 @@
  * @return (@c cxmutstr) the resulting string after applying the replacements
  */
 #define cx_strreplace(str, search, replacement) \
-cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX)
+        cx_strreplacen_a(cxDefaultAllocator, str, search, replacement, SIZE_MAX)
 
 /**
  * Creates a string tokenization context.
@@ -1135,12 +1059,7 @@
  * @return a new string tokenization context
  */
 cx_attr_nodiscard
-cx_attr_export
-CxStrtokCtx cx_strtok_(
-        cxstring str,
-        cxstring delim,
-        size_t limit
-);
+CX_EXPORT CxStrtokCtx cx_strtok_(cxstring str, cxstring delim, size_t limit);
 
 /**
  * Creates a string tokenization context.
@@ -1151,7 +1070,7 @@
  * @return (@c CxStrtokCtx) a new string tokenization context
  */
 #define cx_strtok(str, delim, limit) \
-    cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit))
+        cx_strtok_(cx_strcast(str), cx_strcast(delim), (limit))
 
 /**
  * Returns the next token.
@@ -1163,14 +1082,8 @@
  * @return true if successful, false if the limit or the end of the string
  * has been reached
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_access_w(2)
-cx_attr_export
-bool cx_strtok_next(
-        CxStrtokCtx *ctx,
-        cxstring *token
-);
+cx_attr_nonnull  cx_attr_nodiscard  cx_attr_access_w(2)
+CX_EXPORT bool cx_strtok_next(CxStrtokCtx *ctx, cxstring *token);
 
 /**
  * Returns the next token of a mutable string.
@@ -1186,14 +1099,8 @@
  * @return true if successful, false if the limit or the end of the string
  * has been reached
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_access_w(2)
-cx_attr_export
-bool cx_strtok_next_m(
-        CxStrtokCtx *ctx,
-        cxmutstr *token
-);
+cx_attr_nonnull  cx_attr_nodiscard  cx_attr_access_w(2)
+CX_EXPORT bool cx_strtok_next_m(CxStrtokCtx *ctx, cxmutstr *token);
 
 /**
  * Defines an array of more delimiters for the specified tokenization context.
@@ -1202,14 +1109,8 @@
  * @param delim array of more delimiters
  * @param count number of elements in the array
  */
-cx_attr_nonnull
-cx_attr_access_r(2, 3)
-cx_attr_export
-void cx_strtok_delim(
-        CxStrtokCtx *ctx,
-        const cxstring *delim,
-        size_t count
-);
+cx_attr_nonnull cx_attr_access_r(2, 3)
+CX_EXPORT void cx_strtok_delim(CxStrtokCtx *ctx, const cxstring *delim, size_t count);
 
 /* ------------------------------------------------------------------------- *
  *                string to number conversion functions                      *
@@ -1229,8 +1130,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtos_lc_(cxstring str, short *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1246,8 +1147,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoi_lc_(cxstring str, int *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1263,8 +1164,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtol_lc_(cxstring str, long *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1280,8 +1181,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoll_lc_(cxstring str, long long *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1297,8 +1198,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoi8_lc_(cxstring str, int8_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1314,8 +1215,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoi16_lc_(cxstring str, int16_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1331,8 +1232,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoi32_lc_(cxstring str, int32_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1348,8 +1249,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoi64_lc_(cxstring str, int64_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1365,8 +1266,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtous_lc_(cxstring str, unsigned short *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1382,8 +1283,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtou_lc_(cxstring str, unsigned int *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1399,8 +1300,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoul_lc_(cxstring str, unsigned long *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1416,8 +1317,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoull_lc_(cxstring str, unsigned long long *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1433,8 +1334,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtou8_lc_(cxstring str, uint8_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1450,8 +1351,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtou16_lc_(cxstring str, uint16_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1467,8 +1368,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtou32_lc_(cxstring str, uint32_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1484,8 +1385,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtou64_lc_(cxstring str, uint64_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a number.
@@ -1501,8 +1402,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtoz_lc_(cxstring str, size_t *output, int base, const char *groupsep);
 
 /**
  * Converts a string to a single precision floating-point number.
@@ -1518,8 +1419,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtof_lc_(cxstring str, float *output, char decsep, const char *groupsep);
 
 /**
  * Converts a string to a double precision floating-point number.
@@ -1535,8 +1436,8 @@
  * @retval zero success
  * @retval non-zero conversion was not possible
  */
-cx_attr_access_w(2) cx_attr_nonnull_arg(2) cx_attr_export
-int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep);
+cx_attr_access_w(2) cx_attr_nonnull_arg(2)
+CX_EXPORT int cx_strtod_lc_(cxstring str, double *output, char decsep, const char *groupsep);
 
 /**
  * Converts a string to a number.

mercurial