Debian Codegraph @

xo/dmalloc.h

raw
1 /* dmalloc.h
2 $Id: dmalloc.h,v 1.4 1997/10/18 04:57:33 elf Exp $
3
4 written by Marc Singer
5 27 May 1997
6
7 This file is part of the project XO. See the file README for
8 more information.
9
10 Copyright (C) 1997 Marc Singer
11
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 in a file called COPYING along with this program; if not, write to
24 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
25 02139, USA.
26
27 Debugging memory allocator.
28
29 */
30
31 #if !defined (__DMALLOC_H__)
32 # define __DMALLOC_H__
33
34 /* ----- Includes */
35
36 #include "memory.h"
37
38 /* ----- Globals */
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 void* _malloc_ (size_t cb, const char*, int);
45 void* _calloc_ (size_t c, size_t cb, const char*, int);
46 void* _realloc_ (void* pv, size_t cb, const char*, int);
47 void _free_ (void* pv);
48
49 void dmalloc_exit (void);
50 void dmalloc_validate (void);
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #ifdef __cplusplus
57 void* operator new (size_t, const char*, int);
58 void operator delete (void*);
59 #endif
60
61 #if !defined (BY_DMALLOC)
62 # define new new(__FILE__,__LINE__)
63 # define calloc(c,cb) _calloc_((c),(cb),__FILE__,__LINE__)
64 # define malloc(cb) _malloc_((cb),__FILE__,__LINE__)
65 # define realloc(pv,cb) _realloc_((pv),(cb),__FILE__,__LINE__)
66 # define free _free_
67 #endif
68
69
70 #endif /* __DMALLOC_H__ */