C Collections

cstring · Section 3

cstr_construct_mp_scoped

cstr_construct_mp_scoped - declare and initialise a cstr with custom mprocs and RAII

C Collections (libccollections, -lccollections)

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

This macro does cstr_declare_scoped() and cstr_init_mp() in one
statement. Once the variable leaves its scope the string is destroyed
automatically, through the same custom memory management procedures.

s        Variable name to create
initial  Initial content (C string or NULL for empty string)
mprocs   Custom memory management procedures (ccol_memmgmt_procs *)

This macro needs GCC or Clang, because it uses __attribute__((cleanup))

cstr_construct_scoped(3), cstr_construct_mp(3)