C Collections

cstring · Section 3

cstr_init_mp

cstr_init_mp - initialise a declared cstr with custom memory management

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
cstr_init_mp(s, initial, mprocs);

This macro initialises the cstr variable s through cstring_create_full(),
with the content and the memory management procedures you give. You must
declare s first. If the creation fails, the macro calls
ccol__fatal_err().

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)
mprocs   Custom memory management procedures (ccol_memmgmt_procs *)

A failed allocation ends in ccol__fatal_err()

cstr_init(3), cstr_construct_mp(3), cstring_create_full(3)