1 /************************************************/
4 /* Jean-Marc Pigeon <jmp@safe.ca> 2009 */
6 /************************************************/
7 /* This program is free software; you can */
8 /* redistribute it and/or modify it under the */
9 /* terms of the GNU General Public License as */
10 /* published by the Free Software Foundation */
11 /* version 2 of the License */
13 /* This program is distributed in the hope that */
14 /* it will be useful, but WITHOUT ANY WARRANTY; */
15 /* without even the implied warranty of */
16 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR */
17 /* PURPOSE. See the GNU General Public License */
18 /* for more details. */
20 /* You should have received a copy of the GNU */
21 /* General Public License along with this */
22 /* program; if not, write to the Free Software */
23 /* Foundation, Inc., 51 Franklin Street, */
24 /* Fifth Floor, Boston, MA 02110-1301, USA. */
25 /************************************************/
27 /* Define sub level procedure to debug */
30 /************************************************/
36 /*define it at compile if you want to look for */
37 /*memory leak, report is displayed each time */
38 /*dbg_dumpmem is called. */
45 /*to activate Memory leak detector */
46 #define DMTRUE 1 /*Boolean */
47 #define DMFALSE 0 /*Boolean */
51 #error "Caution, See dbgmem.h,"
52 #error "you should use DEBUGMEM in DEBUG compilation mode"
54 #define DMTRACE DMTRUE
56 #define DMTRACE DMFALSE
60 #define calloc dbg_calloc
61 #define malloc dbg_malloc
62 #define realloc dbg_realloc
64 #define putenv dbg_putenv
65 #define setenv dbg_setenv
66 #define unsetenv dbg_unsetenv
67 #define asprintf dbg_asprintf
68 #define vasprintf dbg_vasprintf
69 #define SYSfree dbg_sysfree
72 #define strdup dbg_strdup
79 extern void dbg_setcurpath(char *path);
80 extern void dbg_setcurbase(char *path);
81 extern void *dbg_malloc(size_t size);
82 extern void *dbg_calloc(size_t nmemb,size_t size);
83 extern void *dbg_realloc(void *ptr,size_t size);
84 extern char *dbg_strdup(const char *str);
85 extern void dbg_free(void *ptr);
86 extern int dbg_putenv(char *valeur);
87 extern int dbg_setenv(const char *name,const char *value,int overwrite);
88 extern int dbg_unsetenv(const char *name);
89 extern int dbg_vasprintf(char **strp, const char *fmt,va_list args);
90 extern int dbg_asprintf(char **strp, const char *fmt, ...);
91 extern void dbg_sysfree(void *ptr);
92 extern void dbg_dumpmem(const char *apname,const char *extension);
93 extern void dbg_setnoleak(int value);