C Collections

cvector · Section 3

cvector_get_mprocs

cvector_get_mprocs - get the memory management procedures of a vector

C Collections (libccollections, -lccollections)

#include <ccollections/cvector.h>
 
ccol_memmgmt_procs *cvector_get_mprocs(cvec v);

Returns the memory management procedures that the vector allocates
through, so code handed an existing vector can allocate scratch storage
from the same allocator.

v    Vector to query

A pointer to the vector's memory management procedures.
NULL when the vector was created with the default allocator, that is when
the mmgmt_procs argument of cvector_create_full() was NULL.

A NULL return isn't an error. It means "use the library's defaults", and
every routine of the library that takes a ccol_memmgmt_procs * accepts
NULL with exactly that meaning.
 
The structure belongs to the library and stays valid until the vector is
destroyed, so don't free it yourself and don't use it after the destroy.
 
Asserts if v is NULL.

cvector_create_full(3), cvec_sort(3), cvector_destroy(3)