cstring · Section 3
cstring_reserve
NAME
cstring_reserve - pre-allocate capacity for at least min_capacity bytes
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cstring.h> bool cstring_reserve(cstr s, size_t min_capacity);
DESCRIPTION
This function makes sure that the internal buffer has room for at least min_capacity bytes, the null terminator included. The requested size is rounded up to the nearest power of two (at least 16), and when the capacity is already large enough the function does nothing.
PARAMETERS
s String to change min_capacity Minimum number of bytes to reserve (including null terminator)
RETURN VALUE
true on success, and also when the capacity was already large enough false when the reallocation fails or the requested size is too large
NOTES
Asserts if s is NULL