mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Further fixes for REALLOC_ZERO_BYTES_FREES comment
* malloc/malloc.c (REALLOC_ZERO_BYTES_FREES): Improve comment further.
This commit is contained in:
@ -346,13 +346,14 @@ __malloc_assert (const char *assertion, const char *file, unsigned int line,
|
|||||||
#define REVEAL_PTR(ptr) PROTECT_PTR (&ptr, ptr)
|
#define REVEAL_PTR(ptr) PROTECT_PTR (&ptr, ptr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
REALLOC_ZERO_BYTES_FREES controls the behavior of realloc (p, 0)
|
The REALLOC_ZERO_BYTES_FREES macro controls the behavior of realloc (p, 0)
|
||||||
when p is nonnull. If nonzero, realloc (p, 0) should free p and
|
when p is nonnull. If the macro is nonzero, the realloc call returns NULL;
|
||||||
return NULL. Otherwise, realloc (p, 0) should do the equivalent
|
otherwise, the call returns what malloc (0) would. In either case,
|
||||||
of freeing p and returning what malloc (0) would return.
|
p is freed. Glibc uses a nonzero REALLOC_ZERO_BYTES_FREES, which
|
||||||
|
implements common historical practice.
|
||||||
|
|
||||||
ISO C17 says the behavior is implementation-defined here; glibc
|
ISO C17 says the realloc call has implementation-defined behavior,
|
||||||
follows historical practice and defines it to be nonzero.
|
and it might not even free p.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef REALLOC_ZERO_BYTES_FREES
|
#ifndef REALLOC_ZERO_BYTES_FREES
|
||||||
|
Reference in New Issue
Block a user