xref: /onnv-gate/usr/src/lib/libparted/common/lib/xalloc-die.c (revision 9663:ace9a2ac3683)
1*9663SMark.Logan@Sun.COM /* Report a memory allocation failure and exit.
2*9663SMark.Logan@Sun.COM 
3*9663SMark.Logan@Sun.COM    Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free
4*9663SMark.Logan@Sun.COM    Software Foundation, Inc.
5*9663SMark.Logan@Sun.COM 
6*9663SMark.Logan@Sun.COM    This program is free software; you can redistribute it and/or modify
7*9663SMark.Logan@Sun.COM    it under the terms of the GNU General Public License as published by
8*9663SMark.Logan@Sun.COM    the Free Software Foundation; either version 2, or (at your option)
9*9663SMark.Logan@Sun.COM    any later version.
10*9663SMark.Logan@Sun.COM 
11*9663SMark.Logan@Sun.COM    This program is distributed in the hope that it will be useful,
12*9663SMark.Logan@Sun.COM    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*9663SMark.Logan@Sun.COM    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*9663SMark.Logan@Sun.COM    GNU General Public License for more details.
15*9663SMark.Logan@Sun.COM 
16*9663SMark.Logan@Sun.COM    You should have received a copy of the GNU General Public License
17*9663SMark.Logan@Sun.COM    along with this program; if not, write to the Free Software Foundation,
18*9663SMark.Logan@Sun.COM    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19*9663SMark.Logan@Sun.COM 
20*9663SMark.Logan@Sun.COM #include <config.h>
21*9663SMark.Logan@Sun.COM 
22*9663SMark.Logan@Sun.COM #include "xalloc.h"
23*9663SMark.Logan@Sun.COM 
24*9663SMark.Logan@Sun.COM #include <stdlib.h>
25*9663SMark.Logan@Sun.COM 
26*9663SMark.Logan@Sun.COM #include "error.h"
27*9663SMark.Logan@Sun.COM #include "exitfail.h"
28*9663SMark.Logan@Sun.COM 
29*9663SMark.Logan@Sun.COM #include "gettext.h"
30*9663SMark.Logan@Sun.COM #define _(msgid) gettext (msgid)
31*9663SMark.Logan@Sun.COM 
32*9663SMark.Logan@Sun.COM void
xalloc_die(void)33*9663SMark.Logan@Sun.COM xalloc_die (void)
34*9663SMark.Logan@Sun.COM {
35*9663SMark.Logan@Sun.COM   error (exit_failure, 0, "%s", _("memory exhausted"));
36*9663SMark.Logan@Sun.COM 
37*9663SMark.Logan@Sun.COM   /* The `noreturn' cannot be given to error, since it may return if
38*9663SMark.Logan@Sun.COM      its first argument is 0.  To help compilers understand the
39*9663SMark.Logan@Sun.COM      xalloc_die does not return, call abort.  Also, the abort is a
40*9663SMark.Logan@Sun.COM      safety feature if exit_failure is 0 (which shouldn't happen).  */
41*9663SMark.Logan@Sun.COM   abort ();
42*9663SMark.Logan@Sun.COM }
43