24ddc71998-03-28Henrik Grubbström (Grubba) /*
88b9f71999-07-04Henrik Grubbström (Grubba)  * $Id: dmalloc.h,v 1.14 1999/07/04 15:47:02 grubba Exp $
24ddc71998-03-28Henrik Grubbström (Grubba)  */
61e9a01998-01-25Fredrik Hübinette (Hubbe) 
1e06921998-10-12Fredrik Hübinette (Hubbe) extern char *debug_xalloc(long); #ifdef DEBUG_MALLOC
2043ba1998-02-10Fredrik Hübinette (Hubbe) struct memhdr; void dump_memhdr_locations(struct memhdr *from, struct memhdr *notfrom); struct memhdr *alloc_memhdr(void);
4218011999-01-31Fredrik Hübinette (Hubbe) void really_free_memhdr(struct memhdr *mh);
2043ba1998-02-10Fredrik Hübinette (Hubbe) void add_marks_to_memhdr(struct memhdr *to,void *ptr); void low_add_marks_to_memhdr(struct memhdr *to, struct memhdr *from);
61e9a01998-01-25Fredrik Hübinette (Hubbe) extern int verbose_debug_malloc; extern int verbose_debug_exit;
ec7d6d1999-05-13Fredrik Hübinette (Hubbe) extern void dmalloc_register(void *, int,const char *, int);
424d9c1999-05-02Fredrik Hübinette (Hubbe) extern int dmalloc_unregister(void *, int);
61e9a01998-01-25Fredrik Hübinette (Hubbe) extern void *debug_malloc(size_t, const char *, int); extern void *debug_calloc(size_t, size_t, const char *, int); extern void *debug_realloc(void *, size_t, const char *, int);
424d9c1999-05-02Fredrik Hübinette (Hubbe) extern void debug_free(void *, const char *, int,int);
61e9a01998-01-25Fredrik Hübinette (Hubbe) extern char *debug_strdup(const char *, const char *, int);
0e88611998-04-16Fredrik Hübinette (Hubbe) extern void reset_debug_malloc(void);
424d9c1999-05-02Fredrik Hübinette (Hubbe) extern void dmalloc_free(void *p);
ec7d6d1999-05-13Fredrik Hübinette (Hubbe) extern int debug_malloc_touch_fd(int, const char *, int); extern int debug_malloc_register_fd(int, const char *, int); extern int debug_malloc_close_fd(int, const char *, int);
61e9a01998-01-25Fredrik Hübinette (Hubbe) void *debug_malloc_update_location(void *,const char *, int); #define malloc(x) debug_malloc((x), __FILE__, __LINE__) #define calloc(x, y) debug_calloc((x), (y), __FILE__, __LINE__) #define realloc(x, y) debug_realloc((x), (y), __FILE__, __LINE__)
424d9c1999-05-02Fredrik Hübinette (Hubbe) #define free(x) debug_free((x), __FILE__, __LINE__,0) #define dmfree(x) debug_free((x),__FILE__,__LINE__,1)
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define strdup(x) debug_strdup((x), __FILE__, __LINE__) #define DO_IF_DMALLOC(X) X
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define debug_malloc_touch(X) debug_malloc_update_location((X),__FILE__,__LINE__) #define debug_malloc_pass(X) debug_malloc_update_location((X),__FILE__,__LINE__)
24dd881998-01-27Fredrik Hübinette (Hubbe) #define xalloc(X) ((char *)debug_malloc_touch(debug_xalloc(X)))
8fb1e11998-04-05Fredrik Hübinette (Hubbe) void debug_malloc_dump_references(void *x);
3c43b81999-03-19Fredrik Hübinette (Hubbe) #define dmalloc_touch(TYPE,X) ((TYPE)debug_malloc_update_location((X),__FILE__,__LINE__))
424d9c1999-05-02Fredrik Hübinette (Hubbe)  #define DMALLOC_LINE_ARGS ,char * dmalloc_file, int dmalloc_line #define DMALLOC_POS ,__FILE__,__LINE__ #define DMALLOC_PROXY_ARGS ,dmalloc_file,dmalloc_line
4093941999-05-03Fredrik Hübinette (Hubbe) void dmalloc_accept_leak(void *);
ec7d6d1999-05-13Fredrik Hübinette (Hubbe) #define dmalloc_touch_fd(X) debug_malloc_touch_fd((X),__FILE__,__LINE__) #define dmalloc_register_fd(X) debug_malloc_register_fd((X),__FILE__,__LINE__) #define dmalloc_close_fd(X) debug_malloc_close_fd((X),__FILE__,__LINE__)
61e9a01998-01-25Fredrik Hübinette (Hubbe) #else
ec7d6d1999-05-13Fredrik Hübinette (Hubbe) #define dmalloc_touch_fd(X) (X) #define dmalloc_register_fd(X) (X) #define dmalloc_close_fd(X) (X)
424d9c1999-05-02Fredrik Hübinette (Hubbe) #define dmfree(X) free((X))
4093941999-05-03Fredrik Hübinette (Hubbe) #define dmalloc_accept_leak(X) (void)(X)
424d9c1999-05-02Fredrik Hübinette (Hubbe) #define DMALLOC_LINE_ARGS #define DMALLOC_POS #define DMALLOC_PROXY_ARGS
8fb1e11998-04-05Fredrik Hübinette (Hubbe) #define debug_malloc_dump_references(X)
24dd881998-01-27Fredrik Hübinette (Hubbe) #define xalloc debug_xalloc
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define dbm_main main
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define DO_IF_DMALLOC(X) #define debug_malloc_update_location(X,Y,Z) (X)
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define debug_malloc_touch(X) #define debug_malloc_pass(X) (X)
3c43b81999-03-19Fredrik Hübinette (Hubbe) #define dmalloc_touch(TYPE,X) (X)
88b9f71999-07-04Henrik Grubbström (Grubba) #define dmalloc_register(X,Y,Z,W)
424d9c1999-05-02Fredrik Hübinette (Hubbe) #define dmalloc_unregister(X,Y) #define debug_free(X,Y,Z,Q) free((X))
61e9a01998-01-25Fredrik Hübinette (Hubbe) #endif