cstring · Section 3
cstring_destroy
NAME
cstring_destroy - destroy a string and set its pointer to NULL
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cstring.h> cstring_destroy(s);
DESCRIPTION
This macro destroys the cstring. It frees the internal buffer and the container itself and then sets the pointer variable s to NULL, which makes a second call safe.
PARAMETERS
s cstr lvalue to destroy, such as a variable or an element of an
array; the macro evaluates it exactly once and sets it to NULL
NOTES
A call with a NULL pointer is safe and does nothing. The internal buffer and the container are freed with the allocator that created the string, which is the custom ccol_memmgmt_procs given to cstring_create_full(), or free() when none was given.
EXAMPLES
cstr s = cstring_create("hello", NULL); cstring_destroy(s); /* s is now NULL */