Blame lib/xalloc-die.c

Packit 33f14e
/* Report a memory allocation failure and exit.
Packit 33f14e
Packit 33f14e
   Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2017 Free Software
Packit 33f14e
   Foundation, Inc.
Packit 33f14e
Packit 33f14e
   This program is free software: you can redistribute it and/or modify
Packit 33f14e
   it under the terms of the GNU General Public License as published by
Packit 33f14e
   the Free Software Foundation; either version 3 of the License, or
Packit 33f14e
   (at your option) any later version.
Packit 33f14e
Packit 33f14e
   This program is distributed in the hope that it will be useful,
Packit 33f14e
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 33f14e
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 33f14e
   GNU General Public License for more details.
Packit 33f14e
Packit 33f14e
   You should have received a copy of the GNU General Public License
Packit 33f14e
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 33f14e
Packit 33f14e
#include <config.h>
Packit 33f14e
Packit 33f14e
#include "xalloc.h"
Packit 33f14e
Packit 33f14e
#include <stdlib.h>
Packit 33f14e
Packit 33f14e
#include "error.h"
Packit 33f14e
#include "exitfail.h"
Packit 33f14e
Packit 33f14e
#include "gettext.h"
Packit 33f14e
#define _(msgid) gettext (msgid)
Packit 33f14e
Packit 33f14e
void
Packit 33f14e
xalloc_die (void)
Packit 33f14e
{
Packit 33f14e
  error (exit_failure, 0, "%s", _("memory exhausted"));
Packit 33f14e
Packit 33f14e
  /* _Noreturn cannot be given to error, since it may return if
Packit 33f14e
     its first argument is 0.  To help compilers understand the
Packit 33f14e
     xalloc_die does not return, call abort.  Also, the abort is a
Packit 33f14e
     safety feature if exit_failure is 0 (which shouldn't happen).  */
Packit 33f14e
  abort ();
Packit 33f14e
}