cstring · Section 3
cstr_init
NAME
cstr_init - initialise a declared cstr with the default allocators
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cstring.h> cstr_init(s, initial);
DESCRIPTION
This macro initialises the cstr variable s with the content you give, through cstring_create(). You must declare s first. If the creation fails, the macro calls ccol__fatal_err().
PARAMETERS
s cstr lvalue to initialise (you must declare it first); the macro
assigns it once, after the string is created
initial Initial content (C string or NULL for empty string)
NOTES
A failed allocation ends in ccol__fatal_err(). If you want to handle an error yourself, call cstring_create() directly
EXAMPLES
cstr_declare(s); cstr_init(s, "hello"); cstr_destroy(s);