-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathmemorydebug.h
More file actions
25 lines (21 loc) · 779 Bytes
/
memorydebug.h
File metadata and controls
25 lines (21 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
void *debug_malloc(size_t size, const char *file, int line);
void *debug_calloc(size_t nmemb, size_t size, const char *file, int line);
void *debug_realloc(void *ptr, size_t size, const char *file, int line);
char *debug_strdup(const char *str, const char *file, int line);
void debug_free(void *ptr, const char *file, int line);
void debug_memorydump(FILE *fp);
#ifdef __cplusplus
}
#endif
#define malloc(a) debug_malloc(a,__FILE__,__LINE__)
#define calloc(a,b) debug_calloc(a,b,__FILE__,__LINE__)
#define realloc(a,b) debug_realloc(a,b,__FILE__,__LINE__)
#ifdef strdup
#undef strdup
#endif
#define strdup(a) debug_strdup(a,__FILE__,__LINE__)
#define free(a) debug_free(a,__FILE__,__LINE__)