diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-04-12 00:33:15 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-04-12 00:45:06 -0700 |
commit | 9f1bed18f9466ac886addb2f79d8e4c52fb65eb5 (patch) | |
tree | 4b63da58181b42ee3650eaa72090d8008ecce909 /malloc/malloc.c | |
parent | 0385d5fff8b7de411443a8ece7cd29f702c3f4fd (diff) | |
download | glibc-9f1bed18f9466ac886addb2f79d8e4c52fb65eb5.tar.gz glibc-9f1bed18f9466ac886addb2f79d8e4c52fb65eb5.tar.xz glibc-9f1bed18f9466ac886addb2f79d8e4c52fb65eb5.zip |
Further fixes for REALLOC_ZERO_BYTES_FREES comment
* malloc/malloc.c (REALLOC_ZERO_BYTES_FREES): Improve comment further.
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 0cd3ba78ca..e2d7b1b583 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -346,13 +346,14 @@ __malloc_assert (const char *assertion, const char *file, unsigned int line, #define REVEAL_PTR(ptr) PROTECT_PTR (&ptr, ptr) /* - 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. + The REALLOC_ZERO_BYTES_FREES macro controls the behavior of realloc (p, 0) + when p is nonnull. If the macro is nonzero, the realloc call returns NULL; + otherwise, the call returns what malloc (0) would. In either case, + p is freed. Glibc uses a nonzero REALLOC_ZERO_BYTES_FREES, which + implements common historical practice. + + ISO C17 says the realloc call has implementation-defined behavior, + and it might not even free p. */ #ifndef REALLOC_ZERO_BYTES_FREES |