[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070727104041.GW27237@ftp.linux.org.uk>
Date: Fri, 27 Jul 2007 11:40:41 +0100
From: Al Viro <viro@....linux.org.uk>
To: Yoann Padioleau <padator@...adoo.fr>
Cc: kernel-janitors@...r.kernel.org, dhowells@...hat.com,
akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/68] 0 -> NULL, for arch/frv
On Fri, Jul 27, 2007 at 12:21:53PM +0200, Yoann Padioleau wrote:
> > On Fri, Jul 27, 2007 at 11:44:35AM +0200, Yoann Padioleau wrote:
> >> pte = pte_alloc_kernel(pme, va);
> >> - if (pte != 0) {
> >> + if (pte != NULL) {
> I don't understand. pte is a pointer right ? So why should we
> keep the == 0 ?
Idiomatic form for "has allocation succeeded?" is neither "if (p != 0)" nor
"if (p != NULL)". It's simply "if (p)".
Note that it depends upon context. For something that combines assignment
with test
if ((p = foo_alloc()) != NULL)
would be the right way to go. Ditto for
flag = (p == NULL)
(alternative would be "flag = !p", which is usually not nice or even
"flag = !!p" for the opposite test, and that's bloody atrocious).
For places like
- if (spu_disassemble_table[o] == 0)
+ if (spu_disassemble_table[o] == NULL)
spu_disassemble_table[o] = &spu_opcodes[i];
it's a matter of taste; there I'd go for explicit comparison with NULL.
I'd also go for explicit comparisons in places like
- wait_event(journal->j_wait_done_commit, journal->j_task == 0);
+ wait_event(journal->j_wait_done_commit, journal->j_task == NULL);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists