/builddir/build/BUILD/gru-0.2.0/src/common/gru_alloc.h File Reference

#include "gru_base.h"
#include "gru_status.h"

Go to the source code of this file.

Defines

#define gru_alloc_check(obj, ret)
 Check whether the allocation was successful otherwise return whatever set as ret.

Functions

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

Define Documentation

#define gru_alloc_check ( obj,
ret   ) 
Value:
if ((obj) == NULL)                                                                     \
        return ret;

Check whether the allocation was successful otherwise return whatever set as ret.


Function Documentation

gru_export void* gru_alloc ( size_t  size,
gru_status_t status 
)

Allocate a block of memory.

Parameters:
size the amount of memory (in bytes) to allocate
status a status pointer that will be set in case of failure
Returns:
a pointer to the newly allocated memory or NULL if failed
gru_export void gru_dealloc ( void **  obj  ) 

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

Parameters:
obj a pointer to a pointer of block of memory to deallocate
gru_export 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:
obj a pointer to a pointer of block of memory to deallocate
gru_export void gru_dealloc_string ( char **  obj  )  [inline]

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

Parameters:
obj a pointer to a pointer of block of memory to deallocate
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 7 Jan 2019 for GRU - Generic Reusable Utilities by  doxygen 1.6.1