| 51 #define CX_PRIstr ".*s" |
51 #define CX_PRIstr ".*s" |
| 52 #define cx_strcast(s) // converts any string to cxstring |
52 #define cx_strcast(s) // converts any string to cxstring |
| 53 ``` |
53 ``` |
| 54 |
54 |
| 55 The functions `cx_str()` and `cx_mutstr()` create a UCX string from a `const char*` or a `char*` |
55 The functions `cx_str()` and `cx_mutstr()` create a UCX string from a `const char*` or a `char*` |
| 56 and compute the length with a call to stdlib `strlen()`. |
56 and compute the length with a call to stdlib `strlen()` (except for `NULL` in which case the length is set to zero). |
| 57 In case you already know the length, or the string is not zero-terminated, you can use `cx_strn()` or `cx_mutstrn()`. |
57 In case you already know the length, or the string is not zero-terminated, you can use `cx_strn()` or `cx_mutstrn()`. |
| 58 |
58 |
| 59 The function `cx_strdup_a()` allocates new memory with the given `allocator` and copies the given `string` |
59 The function `cx_strdup_a()` allocates new memory with the given `allocator` and copies the given `string` |
| 60 and guarantees that the result string is zero-terminated. |
60 and guarantees that the result string is zero-terminated. |
| 61 The function `cx_strdup()` is equivalent to `cx_strdup_a()`, except that it uses the [default allocator](allocator.h.md#default-allocator). |
61 The function `cx_strdup()` is equivalent to `cx_strdup_a()`, except that it uses the [default allocator](allocator.h.md#default-allocator). |