]> git.ipfire.org Git - thirdparty/bash.git/blob - lib/malloc/shmalloc.h
Imported from ../bash-4.0-rc1.tar.gz.
[thirdparty/bash.git] / lib / malloc / shmalloc.h
1 /* Functions (currently) for use by the shell to do malloc debugging and
2 tracking. */
3 /* Copyright (C) 2001-2003 Free Software Foundation, Inc.
4
5 This file is part of GNU Bash, the Bourne-Again SHell.
6
7 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _SH_MALLOC_H
22 #define _SH_MALLOC_H
23
24 #ifndef __P
25 # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
26 # define __P(protos) protos
27 # else
28 # define __P(protos) ()
29 # endif
30 #endif
31
32 /* Generic pointer type. */
33 #ifndef PTR_T
34
35 #if defined (__STDC__)
36 # define PTR_T void *
37 #else
38 # define PTR_T char *
39 #endif
40
41 #endif /* PTR_T */
42
43
44 extern PTR_T sh_malloc __P((size_t, const char *, int));
45 extern PTR_T sh_realloc __P((PTR_T, size_t, const char *, int));
46 extern void sh_free __P((PTR_T, const char *, int));
47
48 extern PTR_T sh_memalign __P((size_t, size_t, const char *, int));
49
50 extern PTR_T sh_calloc __P((size_t, size_t, const char *, int));
51 extern void sh_cfree __P((PTR_T, const char *, int));
52
53 extern PTR_T sh_valloc __P((size_t, const char *, int));
54
55 /* trace.c */
56 extern int malloc_set_trace __P((int));
57 extern void malloc_set_tracefp (); /* full prototype requires stdio.h */
58 extern void malloc_set_tracefn __P((char *, char *));
59
60 /* table.c */
61 extern void mregister_dump_table __P((void));
62 extern void mregister_table_init __P((void));
63 extern int malloc_set_register __P((int));
64
65 /* stats.c */
66 extern void print_malloc_stats __P((char *));
67 extern void fprint_malloc_stats (); /* full prototype requires stdio.h */
68 extern void trace_malloc_stats __P((char *, char *));
69
70 #endif