porting/dpl_lib/src/dpl_mem.c
/**
 * Generic mempool allocation function.  Used with basic and extended mempools.
 */
Generic mempool allocation function.  Used with basic and extended mempools.
Generic mempool allocation function . Used with basic and extended mempools .
static int
mem_malloc_mempool_gen(uint16_t num_blocks, uint32_t block_size,
                       void **out_buf)
{
    block_size = DPL_ALIGN(block_size, DPL_ALIGNMENT);
    if (num_blocks > 0) {
        *out_buf = malloc(DPL_MEMPOOL_BYTES(num_blocks, block_size));
        if (*out_buf == NULL) {
            return DPL_ENOMEM;
        }
    } else {
        *out_buf = NULL;
    }
    return 0;
}
static int mem_malloc_mempool_gen ( uint16_t num_blocks , uint32_t block_size , void * * out_buf ) { block_size = DPL_ALIGN ( block_size , DPL_ALIGNMENT ) ; if ( num_blocks > 0 ) { * out_buf = malloc ( DPL_MEMPOOL_BYTES ( num_blocks , block_size ) ) ; if ( * out_buf == NULL ) { return DPL_ENOMEM ; } } else { * out_buf = NULL ; } return 0 ; }
Generic mempool allocation function.
Generic mempool allocation function .