Mem_DynPoolBlkGet()

Gets a memory block from specified pool, growing it if needed. 

Files

lib_mem.h/lib_mem.c

Prototype

void  *Mem_DynPoolBlkGet (MEM_DYN_POOL  *p_pool,
                          LIB_ERR       *p_err)

Arguments

p_pool

Pointer to pool data.

p_err

Pointer to variable that will receive the return error code from this function.

LIB_MEM_ERR_NONE

LIB_MEM_ERR_NULL_PTR

LIB_MEM_ERR_POOL_EMPTY

LIB_MEM_ERR_INVALID_MEM_ALIGN

LIB_MEM_ERR_INVALID_MEM_SIZE

LIB_MEM_ERR_NULL_PTR

LIB_MEM_ERR_SEG_OVF

Returned Value

Pointer to memory block, if successful.

DEF_NULL, otherwise.

Required Configuration

None.

Notes / Warnings

  1. If there is no block available in the pool when calling this function, it will attempt to allocate a new one on the pool segment.
  2. An usage example of this function is available on Dynamic Memory Pools page.

Related pages