FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
DMalloc.h
1 /***************************************************************
2  Copyright (C) 2007-2011 Hewlett-Packard Development Company, L.P.
3 
4  This program is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public License
6  version 2 as published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 
17  ***************************************************************/
18 #ifndef _DMALLOC_H_
19 #define _DMALLOC_H_
20 
21 
22 #define free(p) DMfree(p,__FILE__,__LINE__)
23 #define malloc(s) DMmalloc(s,__FILE__,__LINE__)
24 #define calloc(s,i) DMcalloc(s,i,__FILE__,__LINE__)
25 #define memcheck(p) DMmemcheck(p,__FILE__,__LINE__)
26 #define realloc(p,s) DMrealloc(p,s,__FILE__,__LINE__)
27 
28 extern int DMverbose;
29 extern char *DMtriggeraddr;
30 
31 #ifdef __cplusplus
32 extern "C" {
33  extern int
34  DMnotfreed(),
35  DMtrigger(),
36  DMfree(char *ptr, char *fname, int line);
37  extern char
38  *DMmemcheck(char *ptr, char *fname, int line),
39  *DMmalloc(int size, char *fname, int line),
40  *DMcalloc(int size, int nitems, char *fname, int line),
41  *DMrealloc(char *ptr, int size, char *fname, int line);
42 }
43 #else /* C */
44 
45 extern int
46 DMnotfreed(),
47 DMtrigger(),
48 DMfree();
49 extern char
50 *DMmemcheck(),
51 *DMmalloc(),
52 *DMcalloc(),
53 *DMrealloc();
54 
55 #endif /* C */
56 
57 #endif /* _DMALLOC_H_ */
DMtrigger()
Dummy routine with the sole purpose of being available for setting breakpoints from a debugger...
Definition: DMalloc.c:348
char * DMrealloc(char *ptr, int size, char *fname, int line)
Reallocate memory safely using realloc()
Definition: DMalloc.c:303
DMnotfreed()
Print a list of memory pointers not freed - one per line.
Definition: DMalloc.c:333
DMfree(char *ptr, char *fname, int line)
Free a pointer allocated by DMmalloc()
Definition: DMalloc.c:150
char * DMcalloc(int size, int nitems, char *fname, int line)
Allocate memory safely using calloc()
Definition: DMalloc.c:215
int DMverbose
Verbosity level.
Definition: DMalloc.c:44
char * DMmalloc(int size, char *fname, int line)
Allocate memory safely using malloc()
Definition: DMalloc.c:181
char * DMmemcheck(char *ptr, char *fname, int line)
Definition: DMalloc.c:128