summaryrefslogtreecommitdiff
path: root/lib/malloc.c
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-04-08 20:54:42 +0200
committerDaniel Llorens <lloda@sarc.name>2021-04-08 21:00:42 +0200
commitbdb07f8fc7b37ef64498c7b06cd4457faf456189 (patch)
tree4c98d2d714f2071513897efe01063bebc36e32cb /lib/malloc.c
parent88e703084567eb99238a3be6ba4285d87a25eeae (diff)
downloadguile-bdb07f8fc7b37ef64498c7b06cd4457faf456189.tar.gz
Update gnulib to a3a946f670718d0dee5a7425ad5ac0a29fb46ea1wip-gnulib-update
This fixes https://lists.gnu.org/archive/html/guile-devel/2021-04/msg00009.html
Diffstat (limited to 'lib/malloc.c')
-rw-r--r--lib/malloc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/malloc.c b/lib/malloc.c
index 0c3e9da68..6bbb97dc2 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -30,7 +30,11 @@
#include <stdlib.h>
-#include <errno.h>
+/* A function definition is only needed if NEED_MALLOC_GNU is defined above
+ or if the module 'malloc-posix' requests it. */
+#if NEED_MALLOC_GNU || (GNULIB_MALLOC_POSIX && !HAVE_MALLOC_POSIX)
+
+# include <errno.h>
/* Allocate an N-byte block of memory from the heap.
If N is zero, allocate a 1-byte block. */
@@ -40,17 +44,19 @@ rpl_malloc (size_t n)
{
void *result;
-#if NEED_MALLOC_GNU
+# if NEED_MALLOC_GNU
if (n == 0)
n = 1;
-#endif
+# endif
result = malloc (n);
-#if !HAVE_MALLOC_POSIX
+# if !HAVE_MALLOC_POSIX
if (result == NULL)
errno = ENOMEM;
-#endif
+# endif
return result;
}
+
+#endif