195b7b453SJohn Marino /* Report a memory allocation failure and exit.
295b7b453SJohn Marino
3*09d4459fSDaniel Fojt Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2020 Free Software
4200fbe8dSJohn Marino Foundation, Inc.
595b7b453SJohn Marino
695b7b453SJohn Marino This program is free software: you can redistribute it and/or modify
795b7b453SJohn Marino it under the terms of the GNU General Public License as published by
895b7b453SJohn Marino the Free Software Foundation; either version 3 of the License, or
995b7b453SJohn Marino (at your option) any later version.
1095b7b453SJohn Marino
1195b7b453SJohn Marino This program is distributed in the hope that it will be useful,
1295b7b453SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
1395b7b453SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1495b7b453SJohn Marino GNU General Public License for more details.
1595b7b453SJohn Marino
1695b7b453SJohn Marino You should have received a copy of the GNU General Public License
17*09d4459fSDaniel Fojt along with this program. If not, see <https://www.gnu.org/licenses/>. */
1895b7b453SJohn Marino
1995b7b453SJohn Marino #include <config.h>
2095b7b453SJohn Marino
2195b7b453SJohn Marino #include "xalloc.h"
2295b7b453SJohn Marino
2395b7b453SJohn Marino #include <stdlib.h>
2495b7b453SJohn Marino
2595b7b453SJohn Marino #include "error.h"
2695b7b453SJohn Marino #include "exitfail.h"
2795b7b453SJohn Marino
2895b7b453SJohn Marino #include "gettext.h"
2995b7b453SJohn Marino #define _(msgid) gettext (msgid)
3095b7b453SJohn Marino
3195b7b453SJohn Marino void
xalloc_die(void)3295b7b453SJohn Marino xalloc_die (void)
3395b7b453SJohn Marino {
3495b7b453SJohn Marino error (exit_failure, 0, "%s", _("memory exhausted"));
3595b7b453SJohn Marino
36cf28ed85SJohn Marino /* _Noreturn cannot be given to error, since it may return if
3795b7b453SJohn Marino its first argument is 0. To help compilers understand the
3895b7b453SJohn Marino xalloc_die does not return, call abort. Also, the abort is a
3995b7b453SJohn Marino safety feature if exit_failure is 0 (which shouldn't happen). */
4095b7b453SJohn Marino abort ();
4195b7b453SJohn Marino }
42