X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnu%2Fxmalloc.c;h=e246559f873bcc5f497526a235a268363a813444;hb=4dc51be0a8b8cdf233fc71e6731ddf53204b8060;hp=b9451a4c20b3d64b2a6226038a0b036adfd996a5;hpb=f3797c1231154dc0bbade50aceaa8639ffd9e3cf;p=debian%2Ftar diff --git a/gnu/xmalloc.c b/gnu/xmalloc.c index b9451a4c..e246559f 100644 --- a/gnu/xmalloc.c +++ b/gnu/xmalloc.c @@ -1,8 +1,6 @@ -/* -*- buffer-read-only: t -*- vi: set ro: */ -/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2011 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2015 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 @@ -19,11 +17,9 @@ #include -#if ! HAVE_INLINE -# define static_inline -#endif +#define XALLOC_INLINE _GL_EXTERN_INLINE + #include "xalloc.h" -#undef static_inline #include #include @@ -54,8 +50,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; }