C Collections

cstring · Section 3

cstr_reserve

cstr_reserve - reserve capacity, and call ccol__fatal_err() on failure

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
cstr_reserve(s, cap);

This macro calls cstring_reserve(), and when that call returns false it
calls ccol__fatal_err().

s     cstr to change
cap   Minimum number of bytes to reserve (with the null terminator)

The macro evaluates cap exactly once, so the failure message reports the
capacity that the call really used.
If you want to handle an error yourself, call cstring_reserve() directly.

cstring_reserve(3)