# HG changeset patch # User Mike Becker # Date 1759946972 -7200 # Node ID e67caa21d5a707d74f71495825415302c2917c1b # Parent 40074e643663add9e416e8a6f5d3863f28d5e1ba add unsigned char strings to cx_strcast() and changes documentation also relates to #700 diff -r 40074e643663 -r e67caa21d5a7 src/cx/string.h --- a/src/cx/string.h Fri Oct 03 18:58:44 2025 +0200 +++ b/src/cx/string.h Wed Oct 08 20:09:32 2025 +0200 @@ -304,20 +304,16 @@ } /** -* Casts a mutable string to an immutable string. -* -* Does nothing for already immutable strings. -* -* @note This is not seriously a cast. Instead, you get a copy -* of the struct with the desired pointer type. Both structs still -* point to the same location, though! -* -* @param str (@c cxstring or @c cxmutstr) the string to cast -* @return (@c cxstring) an immutable copy of the string pointer -*/ + * Wraps any string into an UCX string. + * + * @param str (any supported string type) the string to cast + * @return (@c cxstring) the string wrapped as UCX string + */ #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 char*: cx_strcast_z, \ char *: cx_strcast_z) (str) #endif