1 /* xmalloc.h -- defines for the `x' memory allocation functions */
3 /* Copyright (C) 2001 Free Software Foundation, Inc.
5 This file is part of GNU Bash, the Bourne Again SHell.
7 Bash is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with Bash; see the file COPYING. If not, write to the Free Software
19 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
21 #if !defined (_XMALLOC_H_)
27 /* Generic pointer type. */
30 #if defined (__STDC__)
38 /* Allocation functions in xmalloc.c */
39 extern PTR_T xmalloc
__P((size_t));
40 extern PTR_T xrealloc
__P((void *, size_t));
41 extern void xfree
__P((void *));
43 #if defined(USING_BASH_MALLOC) && !defined (DISABLE_MALLOC_WRAPPERS)
44 extern PTR_T sh_xmalloc
__P((size_t, const char *, int));
45 extern PTR_T sh_xrealloc
__P((void *, size_t, const char *, int));
46 extern void sh_xfree
__P((void *, const char *, int));
48 #define xmalloc(x) sh_xmalloc((x), __FILE__, __LINE__)
49 #define xrealloc(x, n) sh_xrealloc((x), (n), __FILE__, __LINE__)
50 #define xfree(x) sh_xfree((x), __FILE__, __LINE__)
55 #define free(x) sh_xfree((x), __FILE__, __LINE__)
56 #endif /* USING_BASH_MALLOC */
58 #endif /* _XMALLOC_H_ */