public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
To: Florian Weimer <fweimer@redhat.com>
Cc: eggert@cs.ucla.edu, libc-alpha@sourceware.org
Subject: Re: Fix REALLOC_ZERO_BYTES_FREES comment
Date: Mon, 12 Apr 2021 08:19:24 +0200	[thread overview]
Message-ID: <mwim4st47n.fsf@tomate.loria.fr> (raw)
In-Reply-To: <8735vwows4.fsf@oldenburg.str.redhat.com> (message from Florian Weimer on Mon, 12 Apr 2021 08:13:31 +0200)

       Hi Florian,

> > you write "If nonzero, ... should free p .... Otherwise ... should do the
> > equivalent of freeing p". Is there a difference between "free p" and "do the
> > equivalent of freeing p"?
> 
> It's freeing p followed by malloc (0).

sorry I was not clear. The complete sentence proposed by Paul is

"Otherwise, realloc (p, 0) should do the equivalent of freeing p and returning
what malloc (0) would return."

Why not simply the following?

"Otherwise, realloc (p, 0) should free p and return what malloc (0) would."

Am I overlooking something? What puzzles me is why we write "free p" in the
first part and "do the equivalent of freeing p" in the second one.

Paul


  reply	other threads:[~2021-04-12  6:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 21:42 Paul Eggert
2021-04-12  6:05 ` Paul Zimmermann
2021-04-12  6:13   ` Florian Weimer
2021-04-12  6:19     ` Paul Zimmermann [this message]
2021-04-12  7:48       ` Paul Eggert
2021-04-12  7:53         ` Florian Weimer
2021-04-12 19:44         ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mwim4st47n.fsf@tomate.loria.fr \
    --to=paul.zimmermann@inria.fr \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).