On Wed, Mar 07, 2007 at 07:52:24AM -0500, Theodore Tso wrote:
On Wed, Mar 07, 2007 at 09:59:19AM +0000, Philip Armstrong wrote:

Those if(probe.thingy) guards are entirely redundant: free(p) is a
no-op if p is NULL.

I didn't use that particular patch, but one that uses a goto into the
standard function exit/cleanup path.
However, e2fsprogs is still mostly written in a pre-C99 style, because
there are systems where free() will fail or crash if passed the NULL
pointer.  (I'll note that the gdb coding standards still requires the
use of xfree(), which does the null pointer check because of this
concession to pragmatics.)  So Steinar simply wrote the patch in the
style of the surrounding code, which is a Good Thing.

Argh. (Point taken on the style issue though.)

Phil

ps: Wasn't free(NULL) supposed to be OK in C*89* ?? <googles> Ah yes,
the Rationale specifically mentions it: "The null pointer is specified
as a valid argument to this function to reduce the need for
special-case coding." The real world beats 18 year old standard every
time of course, but are there really actual systems still around
(which e2fsprogs is expected to run on) that crash on free(NULL) ? A
bit depressing if so...

--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to