cstring · Section 3
cstring_create_full
NAME
cstring_create_full - create a string with custom memory management
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cstring.h>
cstr cstring_create_full(const char *initial, ccol_memmgmt_procs *m_procs,
char **err);
DESCRIPTION
This function allocates and initialises a new cstring. When initial is not NULL its content is copied in, and a NULL gives an empty string. The capacity of the internal buffer is rounded up to the nearest power of two, and it is at least 16 bytes.
PARAMETERS
initial Initial C string content, or NULL for an empty string
m_procs Custom memory management procedures, or NULL for the default
malloc/free. The string keeps its own copy of the structure,
so yours does not have to outlive the call
err Optional pointer to receive an error string on failure
RETURN VALUE
A pointer to the new cstring on success NULL on failure, with the details written to *err when err is not NULL