From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Morten Welinder <mwelinder@gmail.com>
Cc: Jim Meyering <jim@meyering.net>,
Junio C Hamano <gitster@pobox.com>, Jean-Luc Herren <jlh@gmx.ch>,
git list <git@vger.kernel.org>
Subject: Re: [PATCH] Remove useless if-before-free tests.
Date: Sun, 24 Feb 2008 11:06:07 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.1.00.0802241100350.6881@eeepc-johanness> (raw)
In-Reply-To: <118833cc0802230530l104acc72k20ceb4b5adcff937@mail.gmail.com>
Hi,
On Sat, 23 Feb 2008, Morten Welinder wrote:
> > +inline void gitfree(void *ptr)
> > +{
> > + if (ptr)
> > + free(ptr);
> > +}
> > +#define free gitfree
> > +#endif
>
> I am wondering why you do it this way. "#define free gitfree" is just
> not valid in a C program that includes the relevant standard header.
> "free" is a reserved symbol.
>
> To stay within the standard, do the define the other way and use
> gitfree everywhere.
We do it this way for other things like fopen, too.
Besides, I think that there should be at least one _real_ case where it
actually _breaks_ before we have a big, ugly, change where it is easy to
overlook a non-converted "free()", instead of a nice, clean and short
patch.
Ciao,
Dscho
prev parent reply other threads:[~2008-02-24 10:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-17 21:58 [PATCH] Remove useless if-before-free tests Jim Meyering
2008-02-17 22:09 ` David Symonds
2008-02-18 9:18 ` Jim Meyering
2008-02-18 9:36 ` Junio C Hamano
2008-02-17 22:16 ` Johannes Schindelin
2008-02-18 9:01 ` Jim Meyering
2008-02-18 14:27 ` Jean-Luc Herren
2008-02-20 10:26 ` Jim Meyering
2008-02-22 17:18 ` Junio C Hamano
2008-02-22 17:35 ` Jim Meyering
2008-02-22 17:40 ` Junio C Hamano
2008-02-22 22:08 ` Jim Meyering
2008-02-22 23:05 ` Junio C Hamano
2008-02-24 18:15 ` Jim Meyering
2009-02-26 13:48 ` Mike Ralphson
2008-02-26 6:59 ` Uwe Kleine-König
2008-02-23 13:30 ` Morten Welinder
2008-02-24 10:06 ` Johannes Schindelin [this message]
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=alpine.DEB.1.00.0802241100350.6881@eeepc-johanness \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jim@meyering.net \
--cc=jlh@gmx.ch \
--cc=mwelinder@gmail.com \
/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