src/cx/string.h

changeset 1304
57e062a4bb05
parent 1297
0811fb9a8dba
equal deleted inserted replaced
1303:4022e403de60 1304:57e062a4bb05
338 const CxAllocator *alloc, 338 const CxAllocator *alloc,
339 cxmutstr *str 339 cxmutstr *str
340 ); 340 );
341 341
342 /** 342 /**
343 * Copies a string.
344 *
345 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire
346 * source string, including a zero-terminator.
347 *
348 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is.
349 *
350 * @param alloc the allocator
351 * @param dest a pointer to the structure where to copy the contents to
352 * @param src the source string
353 *
354 * @retval zero success
355 * @retval non-zero if re-allocation failed
356 */
357 cx_attr_nonnull_arg(1)
358 cx_attr_export
359 int cx_strcpy_a(
360 const CxAllocator *alloc,
361 cxmutstr *dest,
362 cxstring src
363 );
364
365
366 /**
367 * Copies a string.
368 *
369 * The memory in the @p dest structure is either allocated or re-allocated to fit the entire
370 * source string, including a zero-terminator.
371 *
372 * The string in @p dest is guaranteed to be zero-terminated, regardless of whether @p src is.
373 *
374 * @param alloc (@c CxAllocator*) the allocator
375 * @param dest (@c cxmutstr*) a pointer to the structure where to copy the contents to
376 * @param src (@c cxstring) the source string
377 *
378 * @retval zero success
379 * @retval non-zero if re-allocation failed
380 */
381 #define cx_strcpy(dest, src) cx_strcpy_a(cxDefaultAllocator, dest, src)
382
383 /**
343 * Returns the accumulated length of all specified strings. 384 * Returns the accumulated length of all specified strings.
344 * 385 *
345 * If this sum overflows, errno is set to EOVERFLOW. 386 * If this sum overflows, errno is set to EOVERFLOW.
346 * 387 *
347 * @attention if the count argument is larger than the number of the 388 * @attention if the count argument is larger than the number of the

mercurial