]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix REALLOC_ZERO_BYTES_FREES comment to match C17
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Apr 2021 21:39:20 +0000 (14:39 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 11 Apr 2021 21:39:20 +0000 (14:39 -0700)
* malloc/malloc.c (REALLOC_ZERO_BYTES_FREES):
Update comment to match current C standard.

malloc/malloc.c

index 6640385282ec418c867b2747fa9b9a75a7d91c8e..0cd3ba78ca98d0049aca4c051a3dacb8fb596def 100644 (file)
@@ -346,10 +346,13 @@ __malloc_assert (const char *assertion, const char *file, unsigned int line,
 #define REVEAL_PTR(ptr)  PROTECT_PTR (&ptr, ptr)
 
 /*
-  REALLOC_ZERO_BYTES_FREES should be set if a call to
-  realloc with zero bytes should be the same as a call to free.
-  This is required by the C standard. Otherwise, since this malloc
-  returns a unique pointer for malloc(0), so does realloc(p, 0).
+  REALLOC_ZERO_BYTES_FREES controls the behavior of realloc (p, 0)
+  when p is nonnull.  If nonzero, realloc (p, 0) should free p and
+  return NULL.  Otherwise, realloc (p, 0) should do the equivalent
+  of freeing p and returning what malloc (0) would return.
+
+  ISO C17 says the behavior is implementation-defined here; glibc
+  follows historical practice and defines it to be nonzero.
 */
 
 #ifndef REALLOC_ZERO_BYTES_FREES