|
Orcania
Potluck with different functions for different purposes that can be shared among C programs
|
Typedefs | |
| typedef void *(* | o_malloc_t) (size_t) |
| typedef void *(* | o_realloc_t) (void *, size_t) |
| typedef void(* | o_free_t) (void *) |
Functions | |
| void * | o_malloc (size_t size) |
| void * | o_realloc (void *ptr, size_t size) |
| void | o_free (void *ptr) |
| void | o_set_alloc_funcs (o_malloc_t malloc_fn, o_realloc_t realloc_fn, o_free_t free_fn) |
| void | o_get_alloc_funcs (o_malloc_t *malloc_fn, o_realloc_t *realloc_fn, o_free_t *free_fn) |
| typedef void(* o_free_t) (void *) |
| typedef void *(* o_malloc_t) (size_t) |
typedefs use to replace glib's memory functions
| typedef void *(* o_realloc_t) (void *, size_t) |
| void o_free | ( | void * | ptr | ) |
Free a block allocated by o_malloc
| void o_get_alloc_funcs | ( | o_malloc_t * | malloc_fn, |
| o_realloc_t * | realloc_fn, | ||
| o_free_t * | free_fn | ||
| ) |
Gets the pointer to current memory functions
| malloc_fn | reference to a pointer to a malloc function |
| realloc_fn | reference to a pointer to a realloc function |
| free_fn | reference to a pointer to a free function |
| void * o_malloc | ( | size_t | size | ) |
Allocate a memory block
| size | the size of the block to allocate in memory |
| void * o_realloc | ( | void * | ptr, |
| size_t | size | ||
| ) |
Reallocate a memory block
| ptr | the previous memory block that will be free'd |
| size | the size of the block to allocate in memory |
| void o_set_alloc_funcs | ( | o_malloc_t | malloc_fn, |
| o_realloc_t | realloc_fn, | ||
| o_free_t | free_fn | ||
| ) |
Updates the memory functions by user-specific ones
| malloc_fn | a pointer to a malloc function, if NULL, will use current function |
| realloc_fn | a pointer to a realloc function, if NULL, will use current function |
| free_fn | a pointer to a free function, if NULL, will use current function |