| 346 CX_EXPORT void cx_strfree_a(const CxAllocator *alloc, cxmutstr *str); |
346 CX_EXPORT void cx_strfree_a(const CxAllocator *alloc, cxmutstr *str); |
| 347 |
347 |
| 348 /** |
348 /** |
| 349 * Copies a string. |
349 * Copies a string. |
| 350 * |
350 * |
| 351 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
351 * Internal function - do not use. |
| 352 * source string, including a zero-terminator. |
|
| 353 * |
|
| 354 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
|
| 355 * |
352 * |
| 356 * @param alloc the allocator |
353 * @param alloc the allocator |
| 357 * @param dest a pointer to the structure where to copy the contents to |
354 * @param dest a pointer to the structure where to copy the contents to |
| 358 * @param src the source string |
355 * @param src the source string |
| 359 * |
356 * |
| 360 * @retval zero success |
357 * @retval zero success |
| 361 * @retval non-zero if re-allocation failed |
358 * @retval non-zero if re-allocation failed |
| |
359 * @see cx_strcpy_a() |
| 362 */ |
360 */ |
| 363 cx_attr_nonnull_arg(1) |
361 cx_attr_nonnull_arg(1) |
| 364 CX_EXPORT int cx_strcpy_a(const CxAllocator *alloc, cxmutstr *dest, cxstring src); |
362 CX_EXPORT int cx_strcpy_a_(const CxAllocator *alloc, cxmutstr *dest, cxstring src); |
| 365 |
|
| 366 |
363 |
| 367 /** |
364 /** |
| 368 * Copies a string. |
365 * Copies a string. |
| 369 * |
366 * |
| 370 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
367 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
| 371 * source string, including a zero-terminator. |
368 * source string, including a zero-terminator. |
| 372 * |
369 * |
| 373 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
370 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
| 374 * |
371 * |
| |
372 * @param alloc (@c CxAllocator*) the allocator |
| 375 * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to |
373 * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to |
| 376 * @param src (@c cxstring) the source string |
374 * @param src the source string |
| 377 * |
375 * @retval zero success |
| |
376 * @retval non-zero if re-allocation failed |
| |
377 */ |
| |
378 #define cx_strcpy_a(alloc, dest, src) cx_strcpy_a_(alloc, dest, cx_strcast(src)) |
| |
379 |
| |
380 /** |
| |
381 * Copies a string. |
| |
382 * |
| |
383 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire |
| |
384 * source string, including a zero-terminator. |
| |
385 * |
| |
386 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is. |
| |
387 * |
| |
388 * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to |
| |
389 * @param src the source string |
| 378 * @retval zero success |
390 * @retval zero success |
| 379 * @retval non-zero if re-allocation failed |
391 * @retval non-zero if re-allocation failed |
| 380 */ |
392 */ |
| 381 #define cx_strcpy(dest, src) cx_strcpy_a(cxDefaultAllocator, dest, src) |
393 #define cx_strcpy(dest, src) cx_strcpy_a(cxDefaultAllocator, dest, src) |
| 382 |
394 |