isocline
Custom Allocation

Register allocation functions for custom allocators. More...

Typedefs

typedef void *() ic_malloc_fun_t(size_t size)
 
typedef void *() ic_realloc_fun_t(void *p, size_t newsize)
 
typedef void() ic_free_fun_t(void *p)
 

Functions

void ic_init_custom_alloc (ic_malloc_fun_t *_malloc, ic_realloc_fun_t *_realloc, ic_free_fun_t *_free)
 Initialize with custom allocation functions. More...
 
void ic_free (void *p)
 Free a potentially custom alloc'd pointer (in particular, the result returned from ic_readline) More...
 
void * ic_malloc (size_t sz)
 Allocate using the current memory allocator. More...
 
const char * ic_strdup (const char *s)
 Duplicate a string using the current memory allocator. More...
 

Detailed Description

Register allocation functions for custom allocators.

Typedef Documentation

◆ ic_free_fun_t

typedef void() ic_free_fun_t(void *p)

◆ ic_malloc_fun_t

typedef void*() ic_malloc_fun_t(size_t size)

◆ ic_realloc_fun_t

typedef void*() ic_realloc_fun_t(void *p, size_t newsize)

Function Documentation

◆ ic_free()

void ic_free ( void *  p)

Free a potentially custom alloc'd pointer (in particular, the result returned from ic_readline)

◆ ic_init_custom_alloc()

void ic_init_custom_alloc ( ic_malloc_fun_t _malloc,
ic_realloc_fun_t _realloc,
ic_free_fun_t _free 
)

Initialize with custom allocation functions.

This must be called as the first function in a program!

◆ ic_malloc()

void* ic_malloc ( size_t  sz)

Allocate using the current memory allocator.

◆ ic_strdup()

const char* ic_strdup ( const char *  s)

Duplicate a string using the current memory allocator.