C Collections

cstring · Section 3

cstring_new

cstring_new - create a string with default memory management (optimistic)

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
cstr cstring_new(const char *initial);

This is cstring_create_full() with the default malloc/free allocators and
no error output. It is meant for call sites that treat a failed
allocation as fatal and have no use for an error string.

initial   Initial C string content, or NULL for an empty string

A pointer to the new cstring on success
NULL on failure, with no error detail

The call is the same as cstring_create_full(initial, NULL, NULL).
Use cstring_create() when you need an error string on failure.

cstring_create(3), cstring_create_full(3), cstring_destroy(3)