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