XROAD
xroad_mem.h File Reference
#include <common/xroad_common_fwd.h>
#include <stdlib.h>
#include <stdint.h>
Include dependency graph for xroad_mem.h:

Go to the source code of this file.

Functions

void * xroad_mem_malloc (xroad_mem_pool_t *pool, size_t size)
 
void * xroad_mem_calloc (xroad_mem_pool_t *pool, size_t nmemb, size_t size)
 
void * xroad_mem_realloc (xroad_mem_pool_t *pool, void *ptr, size_t size)
 
void xroad_mem_free (xroad_mem_pool_t *pool, void *ptr)
 

Detailed Description

Function Documentation

◆ xroad_mem_calloc()

void* xroad_mem_calloc ( xroad_mem_pool_t *  pool,
size_t  nmemb,
size_t  size 
)

allocate (calloc like) space in memory pool or in glibc, and zero it

Parameters
[in]pool- memory pool. If NuLL, glibc calloc used
[in]nmemb- number of elements to allocate
[in]size- size of member to allocate
Returns
pointer to allocated memory, else failed

◆ xroad_mem_free()

void xroad_mem_free ( xroad_mem_pool_t *  pool,
void *  ptr 
)

free allocated memory in memory pool

Parameters
[in]ptr- memory to free. If NULL, glibc free used

◆ xroad_mem_malloc()

void* xroad_mem_malloc ( xroad_mem_pool_t *  pool,
size_t  size 
)

allocate (malloc like) space in memory pool or in glibc

Parameters
[in]pool- memory pool, If NULL, glibc malloc used
[in]size- size of member to allocate
Returns
pointer to allocated memory, else failed

◆ xroad_mem_realloc()

void* xroad_mem_realloc ( xroad_mem_pool_t *  pool,
void *  ptr,
size_t  size 
)

realloc memory chunk in memory pool or glibc

Parameters
[in]pool- memory pool. If NULL glibc realloc used
[in]ptr- memory to realloc
[in]size- new memory chunk size
Returns
reallocated memory chunk