Cleanup r_string when leaving make_route_string().
[geda-pcb/pcjc2.git] / src / free_atexit.h
blob1aa47d086e6a539df6aef5c4d057378851b39ab4
1 /*!
2 * \file src/free_atexit.c
4 * \brief .
6 * This tiny library is to assist cleaning up harmless memory leaks
7 * caused by (growing) buffers allocated in static variables in
8 * functions.\n
9 * The library provides leaky_ prefixed variants of the common
10 * allocation routines.\n
11 * These wrappers will remember all pointers they return and can free
12 * all memory used, at the end of the application.
15 #include <stdlib.h>
17 #ifdef NDEBUG
18 #define leaky_init()
19 #define leaky_uninit()
20 #define leaky_malloc(size) malloc(size)
21 #define leaky_calloc(nmemb, size) calloc(nmemb, size)
22 #define leaky_realloc(old_memory, size) realloc(old_memory, size)
23 #else
25 void leaky_init (void);
26 void leaky_uninit (void);
27 void *leaky_malloc (size_t size);
28 void *leaky_calloc (size_t nmemb, size_t size);
29 void *leaky_realloc (void* old_memory, size_t size);
32 #endif