libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
low.h File Reference
#include <stdlib.h>
#include <signal.h>

Typedefs

typedef void * onion_low_malloc_sigt (size_t sz)
 Signatures of user configurable memory routine replacement.
typedef void * onion_low_scalar_malloc_sigt (size_t sz)
typedef void * onion_low_calloc_sigt (size_t nmemb, size_t size)
typedef void * onion_low_realloc_sigt (void *ptr, size_t size)
typedef char * onion_low_strdup_sigt (const char *ptr)
typedef void onion_low_free_sigt (void *ptr)
typedef void onion_low_memoryfailure_sigt (const char *msg)
 The memory failure handler is called with a short message.It generally should not return, i.e. should exit, abort, or perhaps setjmp....

Functions

void onion_low_initialize_memory_allocation (onion_low_malloc_sigt *mallocrout, onion_low_scalar_malloc_sigt *scalarmallocrout, onion_low_calloc_sigt *callocrout, onion_low_realloc_sigt *reallocrout, onion_low_strdup_sigt *strduprout, onion_low_free_sigt *freerout, onion_low_memoryfailure_sigt *memoryfailurerout)
 Our configurator for memory routines.To be called once before any other onion processing at initialization. All the routines should be explicitly provided.
void * onion_low_malloc (size_t sz)
 NEVER FAILING MEMORY ALLOCATORS.
void * onion_low_scalar_malloc (size_t sz)
 Our malloc wrapper for scalar data which does not contain any pointers inside.Knowing that a given zone does not contain any pointer can be useful, e.g. to Hans Boehm's conservative garbage collector on http://hboehm.info/gc/ using GC_MALLOC_ATOMIC....
void * onion_low_calloc (size_t nmemb, size_t size)
 Our calloc wrapper for any kind of data, even scalar one.
void * onion_low_realloc (void *ptr, size_t size)
 Our realloc wrapper for any kind of data, even scalar one.
char * onion_low_strdup (const char *str)
 Our strdup wrapper.
void * onion_low_try_malloc (size_t sz)
 POSSIBLY FAILING MEMORY ALLOCATORS.
void * onion_low_try_scalar_malloc (size_t sz)
 Our malloc wrapper for scalar data which does not contain any pointers inside. May return NULL on fail.
void * onion_low_try_calloc (size_t nmemb, size_t size)
 Our calloc wrapper for any kind of data, even scalar one. May return NULL on fail.
void * onion_low_try_realloc (void *ptr, size_t size)
 Our realloc wrapper for any kind of data, even scalar one. May return NULL on fail.
char * onion_low_try_strdup (const char *str)
 Our strdup wrapper. May return NULL on fail.
void onion_low_free (void *ptr)
 Our free wrapper for any kind of data, even scalar one.