Helpers for debugging and custom allocators. More...
Typedefs | |
typedef void | lh_fatalfun(int err, const char *msg) |
A fatal function is called on fatal errors. | |
typedef void * | lh_mallocfun(size_t size) |
Type of malloc functions. | |
typedef void * | lh_callocfun(size_t n, size_t size) |
Type of calloc functions. | |
typedef void * | lh_reallocfun(void *p, size_t size) |
Type of realloc functions. | |
typedef void | lh_freefun(const void *p) |
Type of free functions. | |
Functions | |
void | lh_print_stats (FILE *out) |
Print out statistics. | |
void | lh_check_memory (FILE *out) |
Check at the end of the program if all continuations were released. | |
void | lh_register_onfatal (lh_fatalfun *onfatal) |
Register a function that is called on fatal errors. More... | |
void | lh_register_malloc (lh_mallocfun *malloc, lh_callocfun *calloc, lh_reallocfun *realloc, lh_freefun *free) |
Register custom allocation functions. | |
void * | lh_malloc (size_t size) |
Default malloc . | |
void * | lh_calloc (size_t count, size_t size) |
Default calloc . | |
void * | lh_realloc (void *p, size_t newsize) |
Default realloc . | |
void | lh_free (void *p) |
Default free . | |
char * | lh_strdup (const char *s) |
Default strdup . | |
char * | lh_strndup (const char *s, size_t max) |
Default strndup . | |
void | lh_debug_wait_for_enter () |
Wait for an enter key in debug mode. | |
Helpers for debugging and custom allocators.
void lh_register_onfatal | ( | lh_fatalfun * | onfatal | ) |
Register a function that is called on fatal errors.
Use NULL for the default handler (outputs the error to stderr and exits)