C Collections

cstring · Section 3

cstring_create_full

cstring_create_full - create a string with custom memory management

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
cstr cstring_create_full(const char *initial, ccol_memmgmt_procs *m_procs,
                         char **err);

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.

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

A pointer to the new cstring on success
NULL on failure, with the details written to *err when err is not NULL

cstring_create(3), cstring_destroy(3)