memory array allocator¶
memory array allocator
pseudo dynamic allocation in static memory arrays
-
void
memarray_init
(memarray_t * mem, void * data,msp430_types.h::size_t
size,msp430_types.h::size_t
num)¶ Initialize memarray pool with free list.
Parameters
mem: memarray pool to initialize data: pointer to user-allocated data size: size of a single element in data num: number of elements in data
-
void *
memarray_alloc
(memarray_t * mem)¶ Allocate memory chunk in memarray pool.
Parameters
mem: memarray pool to allocate block in Return values
- pointer to allocated structure, if enough memory was available
- NULL, on failure
-
void
memarray_free
(memarray_t * mem, void * ptr)¶ Free memory chunk in memarray pool.
Parameters
mem: memarray pool to free block in ptr: pointer to memarray chunk