11acd27e7Smillert /* xmalloc.h -- memory allocation that aborts on errors. */
21acd27e7Smillert
31acd27e7Smillert /* Copyright (C) 1999 Free Software Foundation, Inc.
41acd27e7Smillert
51acd27e7Smillert This file is part of the GNU Readline Library, a library for
61acd27e7Smillert reading lines of text with interactive input and history editing.
71acd27e7Smillert
81acd27e7Smillert The GNU Readline Library is free software; you can redistribute it
91acd27e7Smillert and/or modify it under the terms of the GNU General Public License
101acd27e7Smillert as published by the Free Software Foundation; either version 2, or
111acd27e7Smillert (at your option) any later version.
121acd27e7Smillert
131acd27e7Smillert The GNU Readline Library is distributed in the hope that it will be
141acd27e7Smillert useful, but WITHOUT ANY WARRANTY; without even the implied warranty
151acd27e7Smillert of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
161acd27e7Smillert GNU General Public License for more details.
171acd27e7Smillert
181acd27e7Smillert The GNU General Public License is often shipped with GNU software, and
191acd27e7Smillert is generally kept in a file called COPYING or LICENSE. If you do not
201acd27e7Smillert have a copy of the license, write to the Free Software Foundation,
211acd27e7Smillert 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
221acd27e7Smillert
231acd27e7Smillert #if !defined (_XMALLOC_H_)
241acd27e7Smillert #define _XMALLOC_H_
251acd27e7Smillert
261acd27e7Smillert #if defined (READLINE_LIBRARY)
271acd27e7Smillert # include "rlstdc.h"
281acd27e7Smillert #else
291acd27e7Smillert # include <readline/rlstdc.h>
301acd27e7Smillert #endif
311acd27e7Smillert
32*af70c2dfSkettenis #include <stdio.h>
33*af70c2dfSkettenis
341acd27e7Smillert #ifndef PTR_T
351acd27e7Smillert
361acd27e7Smillert #ifdef __STDC__
371acd27e7Smillert # define PTR_T void *
381acd27e7Smillert #else
391acd27e7Smillert # define PTR_T char *
401acd27e7Smillert #endif
411acd27e7Smillert
421acd27e7Smillert #endif /* !PTR_T */
431acd27e7Smillert
44*af70c2dfSkettenis extern PTR_T xmalloc PARAMS((size_t));
45*af70c2dfSkettenis extern PTR_T xrealloc PARAMS((void *, size_t));
46*af70c2dfSkettenis extern void xfree PARAMS((void *));
47*af70c2dfSkettenis
4863bef317Sbeck static void
memory_error_and_abort(fname)4963bef317Sbeck memory_error_and_abort (fname)
5063bef317Sbeck char *fname;
5163bef317Sbeck {
5263bef317Sbeck fprintf (stderr, "%s: out of virtual memory\n", fname);
5363bef317Sbeck exit (2);
5463bef317Sbeck }
55*af70c2dfSkettenis
561acd27e7Smillert #endif /* _XMALLOC_H_ */
57