FOSSology  4.4.0
Open Source License Compliance by Open Source Software
DMalloc.h
1 /*
2  SPDX-FileCopyrightText: © 2007-2011 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #ifndef _DMALLOC_H_
8 #define _DMALLOC_H_
9 
10 
11 #define free(p) DMfree(p,__FILE__,__LINE__)
12 #define malloc(s) DMmalloc(s,__FILE__,__LINE__)
13 #define calloc(s,i) DMcalloc(s,i,__FILE__,__LINE__)
14 #define memcheck(p) DMmemcheck(p,__FILE__,__LINE__)
15 #define realloc(p,s) DMrealloc(p,s,__FILE__,__LINE__)
16 
17 extern int DMverbose;
18 extern char *DMtriggeraddr;
19 
20 #ifdef __cplusplus
21 extern "C" {
22  extern int
23  DMnotfreed(),
24  DMtrigger(),
25  DMfree(char *ptr, char *fname, int line);
26  extern char
27  *DMmemcheck(char *ptr, char *fname, int line),
28  *DMmalloc(int size, char *fname, int line),
29  *DMcalloc(int size, int nitems, char *fname, int line),
30  *DMrealloc(char *ptr, int size, char *fname, int line);
31 }
32 #else /* C */
33 
34 extern int
35 DMnotfreed(),
36 DMtrigger(),
37 DMfree();
38 extern char
39 *DMmemcheck(),
40 *DMmalloc(),
41 *DMcalloc(),
42 *DMrealloc();
43 
44 #endif /* C */
45 
46 #endif /* _DMALLOC_H_ */
char * DMcalloc(int size, int nitems, char *fname, int line)
Allocate memory safely using calloc()
Definition: DMalloc.c:203
char * DMmemcheck(char *ptr, char *fname, int line)
Check the validity of allocated memory areas and report any problems.
Definition: DMalloc.c:116
char * DMrealloc(char *ptr, int size, char *fname, int line)
Reallocate memory safely using realloc()
Definition: DMalloc.c:291
DMnotfreed()
Print a list of memory pointers not freed - one per line.
Definition: DMalloc.c:321
DMfree(char *ptr, char *fname, int line)
Free a pointer allocated by DMmalloc()
Definition: DMalloc.c:138
DMtrigger()
Dummy routine with the sole purpose of being available for setting breakpoints from a debugger.
Definition: DMalloc.c:336
int DMverbose
Verbosity level.
Definition: DMalloc.c:32
char * DMmalloc(int size, char *fname, int line)
Allocate memory safely using malloc()
Definition: DMalloc.c:169