[uClibc-cvs] uClibc/include stdlib.h,1.35,1.36
Erik Andersen
andersen at uclibc.org
Fri May 23 06:42:57 UTC 2003
Update of /var/cvs/uClibc/include
In directory winder:/tmp/cvs-serv28245/include
Modified Files:
stdlib.h
Log Message:
Cope with autoconf's broken AC_FUNC_MALLOC macro, which redefines malloc as
rpl_malloc if it does not detect glibc style
returning-a-valid-pointer-for-malloc(0) behavior. This wrapper calls malloc()
as usual, but if N is zero, we allocate and return a 1-byte block instead....
sigh...
-Erik
Index: stdlib.h
===================================================================
RCS file: /var/cvs/uClibc/include/stdlib.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- stdlib.h 9 Jan 2003 01:44:24 -0000 1.35
+++ stdlib.h 23 May 2003 06:42:53 -0000 1.36
@@ -547,6 +547,18 @@
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__;
+/* Cope with autoconf's broken AC_FUNC_MALLOC macro, which
+ * redefines malloc to rpl_malloc if it does not detect glibc
+ * style returning-a-valid-pointer-for-malloc(0) behavior. This
+ * calls malloc() as usual, but if N is zero, we allocate and
+ * return a 1-byte block instead.... sigh... */
+static inline char * rpl_malloc (size_t N)
+{
+ if (N == 0) {
+ N++;
+ }
+ return malloc (N);
+}
#endif
#ifndef __need_malloc_and_calloc
More information about the uClibc-cvs
mailing list