C Collections

cvector · Section 3

cvector_destroy

cvector_destroy - destroy a vector and set pointer to NULL

C Collections (libccollections, -lccollections)

#include <ccollections/cvector.h>
 
cvector_destroy(v)

Frees everything the vector owns, its data buffer included, and then sets
the vector pointer to NULL.

v    Vector to destroy. It must be a modifiable lvalue such as a
     variable or an array element; the macro evaluates it exactly once
     and sets it to NULL

Calling it with a NULL pointer is safe and does nothing.
 
The elements are not freed one by one, so when they point to heap buffers
the caller has to free those first.

cvector_create(3)