Function rcsw_alloc
Defined in File alloc.h
Function Documentation
-
void *rcsw_alloc(void *ptr, size_t n_bytes, uint32_t flags)
Allocate
n_bytes
of memory using malloc()/calloc()/etc.This function is the one place in RCSW where memory allocation is done, making it easy and clean for RCSW to be built to:
Never use malloc() for anything (i.e., set RCSW_NOALLOC for all modules). Useful in applications where malloc() is disallowed/not available, such as space and bootstraps without stdlib.
Zero allocated memory (i.e., behave as calloc() and set RCSW_ZALLOC for all modules).
- Parameters:
ptr – Pointer to
n_bytes
of application-allocated memory. Can be NULL if malloc()/calloc() is to be used.n_bytes – The number of bytes to allocate.
flags – Run-time flags. Valid flags are: