xref: /dflybsd-src/contrib/cvs-1.12/lib/xalloc-die.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /* Report a memory allocation failure and exit.
286d7f5d3SJohn Marino 
386d7f5d3SJohn Marino    Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free
486d7f5d3SJohn Marino    Software Foundation, Inc.
586d7f5d3SJohn Marino 
686d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
786d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
886d7f5d3SJohn Marino    the Free Software Foundation; either version 2, or (at your option)
986d7f5d3SJohn Marino    any later version.
1086d7f5d3SJohn Marino 
1186d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
1286d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
1386d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1486d7f5d3SJohn Marino    GNU General Public License for more details.
1586d7f5d3SJohn Marino 
1686d7f5d3SJohn Marino    You should have received a copy of the GNU General Public License
1786d7f5d3SJohn Marino    along with this program; if not, write to the Free Software Foundation,
1886d7f5d3SJohn Marino    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
1986d7f5d3SJohn Marino 
2086d7f5d3SJohn Marino #ifdef HAVE_CONFIG_H
2186d7f5d3SJohn Marino # include <config.h>
2286d7f5d3SJohn Marino #endif
2386d7f5d3SJohn Marino 
2486d7f5d3SJohn Marino #include "xalloc.h"
2586d7f5d3SJohn Marino 
2686d7f5d3SJohn Marino #include <stdlib.h>
2786d7f5d3SJohn Marino 
2886d7f5d3SJohn Marino #include "error.h"
2986d7f5d3SJohn Marino #include "exitfail.h"
3086d7f5d3SJohn Marino 
3186d7f5d3SJohn Marino #include "gettext.h"
3286d7f5d3SJohn Marino #define _(msgid) gettext (msgid)
3386d7f5d3SJohn Marino #define N_(msgid) msgid
3486d7f5d3SJohn Marino 
3586d7f5d3SJohn Marino void
xalloc_die(void)3686d7f5d3SJohn Marino xalloc_die (void)
3786d7f5d3SJohn Marino {
3886d7f5d3SJohn Marino   error (exit_failure, 0, "%s", _("memory exhausted"));
3986d7f5d3SJohn Marino 
4086d7f5d3SJohn Marino   /* The `noreturn' cannot be given to error, since it may return if
4186d7f5d3SJohn Marino      its first argument is 0.  To help compilers understand the
4286d7f5d3SJohn Marino      xalloc_die does not return, call abort.  Also, the abort is a
4386d7f5d3SJohn Marino      safety feature if exit_failure is 0 (which shouldn't happen).  */
4486d7f5d3SJohn Marino   abort ();
4586d7f5d3SJohn Marino }
46