xref: /dflybsd-src/contrib/gdb-7/readline/xmalloc.h (revision 16003dcfd2baa152f5dd24794ec9f36e139eaeb8)
1*6b445a62SJohn Marino /* xmalloc.h -- memory allocation that aborts on errors. */
2*6b445a62SJohn Marino 
3*6b445a62SJohn Marino /* Copyright (C) 1999-2009 Free Software Foundation, Inc.
4*6b445a62SJohn Marino 
5*6b445a62SJohn Marino    This file is part of the GNU Readline Library (Readline), a library
6*6b445a62SJohn Marino    for reading lines of text with interactive input and history editing.
7*6b445a62SJohn Marino 
8*6b445a62SJohn Marino    Readline is free software: you can redistribute it and/or modify
9*6b445a62SJohn Marino    it under the terms of the GNU General Public License as published by
10*6b445a62SJohn Marino    the Free Software Foundation, either version 3 of the License, or
11*6b445a62SJohn Marino    (at your option) any later version.
12*6b445a62SJohn Marino 
13*6b445a62SJohn Marino    Readline is distributed in the hope that it will be useful,
14*6b445a62SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*6b445a62SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*6b445a62SJohn Marino    GNU General Public License for more details.
17*6b445a62SJohn Marino 
18*6b445a62SJohn Marino    You should have received a copy of the GNU General Public License
19*6b445a62SJohn Marino    along with Readline.  If not, see <http://www.gnu.org/licenses/>.
20*6b445a62SJohn Marino */
21*6b445a62SJohn Marino 
22*6b445a62SJohn Marino #if !defined (_XMALLOC_H_)
23*6b445a62SJohn Marino #define _XMALLOC_H_
24*6b445a62SJohn Marino 
25*6b445a62SJohn Marino #if defined (READLINE_LIBRARY)
26*6b445a62SJohn Marino #  include "rlstdc.h"
27*6b445a62SJohn Marino #else
28*6b445a62SJohn Marino #  include <readline/rlstdc.h>
29*6b445a62SJohn Marino #endif
30*6b445a62SJohn Marino 
31*6b445a62SJohn Marino #ifndef PTR_T
32*6b445a62SJohn Marino 
33*6b445a62SJohn Marino #ifdef __STDC__
34*6b445a62SJohn Marino #  define PTR_T	void *
35*6b445a62SJohn Marino #else
36*6b445a62SJohn Marino #  define PTR_T	char *
37*6b445a62SJohn Marino #endif
38*6b445a62SJohn Marino 
39*6b445a62SJohn Marino #endif /* !PTR_T */
40*6b445a62SJohn Marino 
41*6b445a62SJohn Marino /* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER.  */
42*6b445a62SJohn Marino #define xfree xfree_readline
43*6b445a62SJohn Marino 
44*6b445a62SJohn Marino extern PTR_T xmalloc PARAMS((size_t));
45*6b445a62SJohn Marino extern PTR_T xrealloc PARAMS((void *, size_t));
46*6b445a62SJohn Marino extern void xfree PARAMS((void *));
47*6b445a62SJohn Marino 
48*6b445a62SJohn Marino #endif /* _XMALLOC_H_ */
49