GRU - Generic Reusable Utilities
Functions
gru_alloc.c File Reference
#include "gru_alloc.h"

Functions

void * gru_alloc (size_t size, gru_status_t *status)
 Allocate a block of memory. More...
 
void gru_dealloc (void **obj)
 Deallocate a block of memory and set its pointer to NULL. More...
 
void gru_dealloc_string (char **obj)
 Deallocate a block of memory used by a char * and set its pointer to NULL. More...
 
void gru_dealloc_const_string (const char **obj)
 Deallocate a block of memory used by a const char * and set its pointer to NULL. More...
 

Function Documentation

◆ gru_alloc()

void* gru_alloc ( size_t  size,
gru_status_t status 
)

Allocate a block of memory.

Parameters
sizethe amount of memory (in bytes) to allocate
statusa status pointer that will be set in case of failure
Returns
a pointer to the newly allocated memory or NULL if failed

◆ gru_dealloc()

void gru_dealloc ( void **  obj)

Deallocate a block of memory and set its pointer to NULL.

Parameters
obja pointer to a pointer of block of memory to deallocate

◆ gru_dealloc_const_string()

void gru_dealloc_const_string ( const char **  obj)
inline

Deallocate a block of memory used by a const char * and set its pointer to NULL.

Parameters
obja pointer to a pointer of block of memory to deallocate

◆ gru_dealloc_string()

void gru_dealloc_string ( char **  obj)
inline

Deallocate a block of memory used by a char * and set its pointer to NULL.

Parameters
obja pointer to a pointer of block of memory to deallocate
Examples
string/gru_serialize_test.c.