| 303 cxstring: cx_strcast_c) \ |
303 cxstring: cx_strcast_c) \ |
| 304 (str) |
304 (str) |
| 305 #endif |
305 #endif |
| 306 |
306 |
| 307 /** |
307 /** |
| 308 * Passes the pointer in this string to @c free(). |
308 * Passes the pointer in this string to the cxDefaultAllocator's @c free() function. |
| 309 * |
309 * |
| 310 * The pointer in the struct is set to @c NULL and the length is set to zero |
310 * The pointer in the struct is set to @c NULL and the length is set to zero |
| 311 * which means that this function protects you against double-free. |
311 * which means that this function protects you against double-free. |
| 312 * |
312 * |
| 313 * @note There is no implementation for cxstring, because it is unlikely that |
313 * @note There is no implementation for cxstring, because it is unlikely that |
| 452 cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__) |
452 cx_strcat_ma(alloc, cx_mutstrn(NULL, 0), count, __VA_ARGS__) |
| 453 |
453 |
| 454 /** |
454 /** |
| 455 * Concatenates strings and returns a new string. |
455 * Concatenates strings and returns a new string. |
| 456 * |
456 * |
| 457 * The resulting string will be allocated by standard @c malloc(). |
457 * The resulting string will be allocated by the cxDefaultAllocator. |
| 458 * So developers @em must pass the return value to cx_strfree() eventually. |
458 * So developers @em must pass the return value to cx_strfree() eventually. |
| 459 * |
459 * |
| 460 * If memory allocation fails, the pointer in the returned string will |
460 * If memory allocation fails, the pointer in the returned string will |
| 461 * be @c NULL and @c errno might be set. |
461 * be @c NULL and @c errno might be set. |
| 462 * |
462 * |
| 472 cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__) |
472 cx_strcat_ma(cxDefaultAllocator, cx_mutstrn(NULL, 0), count, __VA_ARGS__) |
| 473 |
473 |
| 474 /** |
474 /** |
| 475 * Concatenates strings. |
475 * Concatenates strings. |
| 476 * |
476 * |
| 477 * The resulting string will be allocated by standard @c malloc(). |
477 * The resulting string will be allocated by the cxDefaultAllocator. |
| 478 * So developers @em must pass the return value to cx_strfree() eventually. |
478 * So developers @em must pass the return value to cx_strfree() eventually. |
| 479 * |
479 * |
| 480 * If @p str already contains a string, the memory will be reallocated and |
480 * If @p str already contains a string, the memory will be reallocated and |
| 481 * the other strings are appended. Otherwise, new memory is allocated. |
481 * the other strings are appended. Otherwise, new memory is allocated. |
| 482 * |
482 * |
| 928 cx_strdup_a_((allocator), cx_strcast(string)) |
928 cx_strdup_a_((allocator), cx_strcast(string)) |
| 929 |
929 |
| 930 /** |
930 /** |
| 931 * Creates a duplicate of the specified string. |
931 * Creates a duplicate of the specified string. |
| 932 * |
932 * |
| 933 * The new string will contain a copy allocated by standard |
933 * The new string will contain a copy allocated by the cxDefaultAllocator. |
| 934 * @c malloc(). So developers @em must pass the return value to cx_strfree(). |
934 * So developers @em must pass the return value to cx_strfree(). |
| 935 * |
935 * |
| 936 * @note The returned string is guaranteed to be zero-terminated. |
936 * @note The returned string is guaranteed to be zero-terminated. |
| 937 * |
937 * |
| 938 * @param string the string to duplicate |
938 * @param string the string to duplicate |
| 939 * @return (@c cxmutstr) a duplicate of the string |
939 * @return (@c cxmutstr) a duplicate of the string |
| 1060 /** |
1060 /** |
| 1061 * Replaces a string with another string. |
1061 * Replaces a string with another string. |
| 1062 * |
1062 * |
| 1063 * Replaces at most @p replmax occurrences. |
1063 * Replaces at most @p replmax occurrences. |
| 1064 * |
1064 * |
| 1065 * The returned string will be allocated by @c malloc() and is guaranteed |
1065 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
| 1066 * to be zero-terminated. |
1066 * to be zero-terminated. |
| 1067 * |
1067 * |
| 1068 * If allocation fails, or the input string is empty, |
1068 * If allocation fails, or the input string is empty, |
| 1069 * the returned string will be empty. |
1069 * the returned string will be empty. |
| 1070 * |
1070 * |
| 1096 cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX) |
1096 cx_strreplacen_a(allocator, str, search, replacement, SIZE_MAX) |
| 1097 |
1097 |
| 1098 /** |
1098 /** |
| 1099 * Replaces a string with another string. |
1099 * Replaces a string with another string. |
| 1100 * |
1100 * |
| 1101 * The returned string will be allocated by @c malloc() and is guaranteed |
1101 * The returned string will be allocated by the cxDefaultAllocator and is guaranteed |
| 1102 * to be zero-terminated. |
1102 * to be zero-terminated. |
| 1103 * |
1103 * |
| 1104 * If allocation fails, or the input string is empty, |
1104 * If allocation fails, or the input string is empty, |
| 1105 * the returned string will be empty. |
1105 * the returned string will be empty. |
| 1106 * |
1106 * |