[uClibc-cvs] uClibc/libc/stdlib/malloc-930716 malloc.c,1.9,1.10

Erik Andersen andersen at uclibc.org
Fri Aug 8 10:30:15 UTC 2003


Update of /var/cvs/uClibc/libc/stdlib/malloc-930716
In directory winder:/tmp/cvs-serv19464/libc/stdlib/malloc-930716

Modified Files:
	malloc.c 
Log Message:
Add in a MALLOC_GLIBC_COMPAT option to let people decide if they
want glibc style malloc(0) behavior


Index: malloc.c
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc-930716/malloc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- malloc.c	23 Jan 2003 09:06:36 -0000	1.9
+++ malloc.c	8 Aug 2003 10:30:12 -0000	1.10
@@ -160,9 +160,14 @@
     size_t log, block, blocks, i, lastblocks, start;
     struct list *next;
 
+#if defined(__MALLOC_GLIBC_COMPAT__)
+    if (size == 0)
+	size++;
+#else
     /* Some programs will call malloc (0).  Lets be strict and return NULL */
     if (size == 0)
 	return NULL;
+#endif
 
     if (size < sizeof (struct list))
 	size = sizeof (struct list);




More information about the uClibc-cvs mailing list