From: Jim Meyering <jim@meyering.net>
To: Marcel Holtmann <holtmann@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Sujith.Manoharan@atheros.com,
linville@tuxdriver.com
Subject: Re: [PATCH] ath9k: remove useless if-before-kfree; correct misleading indentation
Date: Sat, 23 Aug 2008 13:28:51 +0200 [thread overview]
Message-ID: <877ia8rmvg.fsf@rho.meyering.net> (raw)
In-Reply-To: <1219489423.7591.480.camel@violet.holtmann.net> (Marcel Holtmann's message of "Sat, 23 Aug 2008 13:03:43 +0200")
Marcel Holtmann <holtmann@linux.intel.com> wrote:
>> >> Alternatively, you could remove the nowadays-useless
>> >> "if-before-kfree" test and leave the sometimes-redundant
>> >> assignment as-is: unconditional.
>> >
>> > actually the later one is preferred. Just remove the NULL check.
>>
>> I prefer it, too, but the indentation suggested that
>> adding braces would match the author's intent.
>>
>> In case anyone is interested, I have been maintaining a patch
>> that removes *all* useless if-before-kfree tests. I have not
>> posted it because such changes have a reputation for provoking
>> flames on this list, but now you've provoked me ;-)
>>
>> http://meyering.net/code/remove-useless-if-before-kfree.patch
>> 74 files changed, 127 insertions(+), 250 deletions(-)
>
> I am all for this patch.
>
> Even the Glibc free() function will do an "if-before-free" :)
Hi Marcel,
Thanks for the support.
Yes, with glibc, free(NULL) is a no-op, and POSIX has required that
behavior for long enough that *all* implementations of free on reasonable
porting targets are NULL-safe these days. There has been plenty of
discussion as I've helped a few projects clean up in this regard, e.g.,
http://thread.gmane.org/gmane.comp.version-control.git/74187
http://thread.gmane.org/gmane.emacs.devel/98144
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
Here are most of the projects that have endured this janitorial work:
git
emacs
glibc
gnulib
coreutils
freeIPA
libvirt
util-linux-ng
idutils
There's even a tool to help ensure that no new useless if-before-kfree
tests sneak back in later.
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/useless-if-before-free
prev parent reply other threads:[~2008-08-23 11:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-23 6:49 [PATCH] ath9k: add harmlessly-omitted braces Jim Meyering
2008-08-23 10:02 ` Marcel Holtmann
2008-08-23 10:25 ` [PATCH] ath9k: remove useless if-before-kfree; correct misleading indentation Jim Meyering
2008-08-23 11:03 ` Marcel Holtmann
2008-08-23 11:28 ` Jim Meyering [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=877ia8rmvg.fsf@rho.meyering.net \
--to=jim@meyering.net \
--cc=Sujith.Manoharan@atheros.com \
--cc=holtmann@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.