Back to index

nagios-plugins  1.4.16
xalloc-die.c
Go to the documentation of this file.
00001 /* Report a memory allocation failure and exit.
00002 
00003    Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2009, 2010
00004    Free Software Foundation, Inc.
00005 
00006    This program is free software: you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #include <config.h>
00020 
00021 #include "xalloc.h"
00022 
00023 #include <stdlib.h>
00024 
00025 #include "error.h"
00026 #include "exitfail.h"
00027 
00028 #include "gettext.h"
00029 #define _(msgid) gettext (msgid)
00030 
00031 void
00032 xalloc_die (void)
00033 {
00034   error (exit_failure, 0, "%s", _("memory exhausted"));
00035 
00036   /* The `noreturn' cannot be given to error, since it may return if
00037      its first argument is 0.  To help compilers understand the
00038      xalloc_die does not return, call abort.  Also, the abort is a
00039      safety feature if exit_failure is 0 (which shouldn't happen).  */
00040   abort ();
00041 }