X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnu%2Fxmalloc.c;h=de7e43f0b6e9d1e07fafb9d1d95eaeaffa310162;hb=4aa85f09e755fc827cd5ab6225f20c83cd42245d;hp=99d5bf4653cc3c8908094f24cb16fda30ea43705;hpb=22f1eb8bc17e5be72dd23d42d6aaa60196ac22e6;p=debian%2Ftar diff --git a/gnu/xmalloc.c b/gnu/xmalloc.c index 99d5bf46..de7e43f0 100644 --- a/gnu/xmalloc.c +++ b/gnu/xmalloc.c @@ -2,9 +2,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2014 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 @@ -21,19 +19,17 @@ #include -#if ! HAVE_INLINE -# define static_inline -#endif +#define XALLOC_INLINE _GL_EXTERN_INLINE + #include "xalloc.h" -#undef static_inline #include #include /* 1 if calloc is known to be compatible with GNU calloc. This matters if we are not also using the calloc module, which defines - HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ -#if defined HAVE_CALLOC || defined __GLIBC__ + HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */ +#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; @@ -56,8 +52,16 @@ xmalloc (size_t n) void * xrealloc (void *p, size_t n) { + if (!n && p) + { + /* The GNU and C99 realloc behaviors disagree here. Act like + GNU, even if the underlying realloc is C99. */ + free (p); + return NULL; + } + p = realloc (p, n); - if (!p && n != 0) + if (!p && n) xalloc_die (); return p; }