|
version 1.1, 2012/02/21 22:57:48
|
version 1.1.1.2, 2021/03/17 13:38:46
|
|
Line 1
|
Line 1
|
| /* malloc() function that is glibc compatible. |
/* malloc() function that is glibc compatible. |
| |
|
| Copyright (C) 1997, 1998, 2006, 2007 Free Software Foundation, Inc. | Copyright (C) 1997-1998, 2006-2007, 2009-2019 Free Software Foundation, Inc. |
| |
|
| This program is free software; you can redistribute it and/or modify |
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 |
it under the terms of the GNU General Public License as published by |
|
Line 13
|
Line 13
|
| GNU General Public License for more details. |
GNU General Public License for more details. |
| |
|
| You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software Foundation, | along with this program; if not, see <https://www.gnu.org/licenses/>. */ |
| Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
| |
|
| /* written by Jim Meyering and Bruno Haible */ |
/* written by Jim Meyering and Bruno Haible */ |
| |
|
| |
#define _GL_USE_STDLIB_ALLOC 1 |
| #include <config.h> |
#include <config.h> |
| /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ |
/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ |
| #ifdef malloc |
#ifdef malloc |
| # define NEED_MALLOC_GNU | # define NEED_MALLOC_GNU 1 |
| # undef malloc |
# undef malloc |
| |
/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */ |
| |
#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU |
| |
# define NEED_MALLOC_GNU 1 |
| #endif |
#endif |
| |
|
| /* Specification. */ |
|
| #include <stdlib.h> |
#include <stdlib.h> |
| |
|
| #include <errno.h> |
#include <errno.h> |
| |
|
| /* Call the system's malloc below. */ |
|
| #undef malloc |
|
| |
|
| /* Allocate an N-byte block of memory from the heap. |
/* Allocate an N-byte block of memory from the heap. |
| If N is zero, allocate a 1-byte block. */ |
If N is zero, allocate a 1-byte block. */ |
| |
|
|
Line 41 rpl_malloc (size_t n)
|
Line 40 rpl_malloc (size_t n)
|
| { |
{ |
| void *result; |
void *result; |
| |
|
| #ifdef NEED_MALLOC_GNU | #if NEED_MALLOC_GNU |
| if (n == 0) |
if (n == 0) |
| n = 1; |
n = 1; |
| #endif |
#endif |