From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1211) id 15C6C385800F; Sun, 11 Apr 2021 21:39:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15C6C385800F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Paul Eggert To: glibc-cvs@sourceware.org Subject: [glibc] Fix REALLOC_ZERO_BYTES_FREES comment to match C17 X-Act-Checkin: glibc X-Git-Author: Paul Eggert X-Git-Refname: refs/heads/master X-Git-Oldrev: 667d9c8d55f035f1d5d2a0b05b101deba3324872 X-Git-Newrev: dff9e592b8f74e2e7be015cbee1c0fad3ef96d37 Message-Id: <20210411213938.15C6C385800F@sourceware.org> Date: Sun, 11 Apr 2021 21:39:38 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:39:38 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dff9e592b8f74e2e7be015cbee1c0fad3ef96d37 commit dff9e592b8f74e2e7be015cbee1c0fad3ef96d37 Author: Paul Eggert Date: Sun Apr 11 14:39:20 2021 -0700 Fix REALLOC_ZERO_BYTES_FREES comment to match C17 * malloc/malloc.c (REALLOC_ZERO_BYTES_FREES): Update comment to match current C standard. Diff: --- malloc/malloc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/malloc/malloc.c b/malloc/malloc.c index 6640385282..0cd3ba78ca 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -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