diff options
author | Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> | 2016-05-27 14:28:30 +0100 |
---|---|---|
committer | Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> | 2016-05-27 14:28:30 +0100 |
commit | a9a31b1de5776a3b08a82101a4fa711294f0dd1d (patch) | |
tree | 159134a624e51509f40ed8823249f09a70d1dda3 /tests/xmalloc.c | |
parent | 5f2b09982312c98863eb9a8dfe2c608b81f58259 (diff) |
Imported Upstream version 0.9.6+really0.9.3upstream/0.9.6+really0.9.3
Diffstat (limited to 'tests/xmalloc.c')
-rw-r--r-- | tests/xmalloc.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/xmalloc.c b/tests/xmalloc.c index e246559f..ecce5296 100644 --- a/tests/xmalloc.c +++ b/tests/xmalloc.c @@ -1,6 +1,8 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2015 Free Software Foundation, Inc. + 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. 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 @@ -17,17 +19,19 @@ #include <config.h> -#define XALLOC_INLINE _GL_EXTERN_INLINE - +#if ! HAVE_INLINE +# define static_inline +#endif #include "xalloc.h" +#undef static_inline #include <stdlib.h> #include <string.h> /* 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_GNU and supports the GNU API even on non-GNU platforms. */ -#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) + HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ +#if defined HAVE_CALLOC || defined __GLIBC__ enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; @@ -50,16 +54,8 @@ 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) + if (!p && n != 0) xalloc_die (); return p; } |