diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-05-21 02:41:10 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-05-21 02:51:01 +0300 |
commit | bc402660605527c438c819e4c94e49285f88f676 (patch) | |
tree | 01e86fb0d6df7febdd63eead34b4b3d36e3ff4e2 /contrib/tools/m4/lib/xalloc-die.c | |
parent | a92a0d80c339ed6f70624dffa79288e61b72e941 (diff) | |
download | ydb-bc402660605527c438c819e4c94e49285f88f676.tar.gz |
Duplicate bison/lib (gnulib) to m4/lib as they actually need to be different
597ee3bf4ec17244e6ef615a1ec10491798e18fe
Diffstat (limited to 'contrib/tools/m4/lib/xalloc-die.c')
-rw-r--r-- | contrib/tools/m4/lib/xalloc-die.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/tools/m4/lib/xalloc-die.c b/contrib/tools/m4/lib/xalloc-die.c new file mode 100644 index 0000000000..daa403b9c8 --- /dev/null +++ b/contrib/tools/m4/lib/xalloc-die.c @@ -0,0 +1,41 @@ +/* Report a memory allocation failure and exit. + + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include "xalloc.h" + +#include <stdlib.h> + +#include "error.h" +#include "exitfail.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) + +void +xalloc_die (void) +{ + error (exit_failure, 0, "%s", _("memory exhausted")); + + /* _Noreturn cannot be given to error, since it may return if + its first argument is 0. To help compilers understand the + xalloc_die does not return, call abort. Also, the abort is a + safety feature if exit_failure is 0 (which shouldn't happen). */ + abort (); +} |