diff for duplicates of <20070727104041.GW27237@ftp.linux.org.uk> diff --git a/a/1.txt b/N1/1.txt index da8b5cb..a29cafe 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -5,7 +5,7 @@ On Fri, Jul 27, 2007 at 12:21:53PM +0200, Yoann Padioleau wrote: > >> + if (pte != NULL) { > I don't understand. pte is a pointer right ? So why should we -> keep the = 0 ? +> keep the == 0 ? Idiomatic form for "has allocation succeeded?" is neither "if (p != 0)" nor "if (p != NULL)". It's simply "if (p)". @@ -14,15 +14,15 @@ 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) + 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) +- 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); +- wait_event(journal->j_wait_done_commit, journal->j_task == 0); ++ wait_event(journal->j_wait_done_commit, journal->j_task == NULL); diff --git a/a/content_digest b/N1/content_digest index eb716f9..c1beced 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -3,7 +3,7 @@ "ref\087hcnq9mf2.fsf@wanadoo.fr\0" "From\0Al Viro <viro@ftp.linux.org.uk>\0" "Subject\0Re: [PATCH 06/68] 0 -> NULL, for arch/frv\0" - "Date\0Fri, 27 Jul 2007 10:40:41 +0000\0" + "Date\0Fri, 27 Jul 2007 11:40:41 +0100\0" "To\0Yoann Padioleau <padator@wanadoo.fr>\0" "Cc\0kernel-janitors@vger.kernel.org" dhowells@redhat.com @@ -18,7 +18,7 @@ "> >> +\tif (pte != NULL) {\n" " \n" "> I don't understand. pte is a pointer right ? So why should we\n" - "> keep the = 0 ? \n" + "> keep the == 0 ? \n" "\n" "Idiomatic form for \"has allocation succeeded?\" is neither \"if (p != 0)\" nor\n" "\"if (p != NULL)\". It's simply \"if (p)\".\n" @@ -27,17 +27,17 @@ "with test\n" "\tif ((p = foo_alloc()) != NULL)\n" "would be the right way to go. Ditto for\n" - "\tflag = (p = NULL)\n" + "\tflag = (p == NULL)\n" "(alternative would be \"flag = !p\", which is usually not nice or even\n" "\"flag = !!p\" for the opposite test, and that's bloody atrocious).\n" "\n" "For places like\n" - "- if (spu_disassemble_table[o] = 0)\n" - "+ if (spu_disassemble_table[o] = NULL)\n" + "- if (spu_disassemble_table[o] == 0)\n" + "+ if (spu_disassemble_table[o] == NULL)\n" " spu_disassemble_table[o] = &spu_opcodes[i];\n" "it's a matter of taste; there I'd go for explicit comparison with NULL.\n" "I'd also go for explicit comparisons in places like\n" - "- wait_event(journal->j_wait_done_commit, journal->j_task = 0);\n" - + wait_event(journal->j_wait_done_commit, journal->j_task = NULL); + "- wait_event(journal->j_wait_done_commit, journal->j_task == 0);\n" + + wait_event(journal->j_wait_done_commit, journal->j_task == NULL); -15572ef93bb85fc131ca48f0628803f0f8ebca9f7363c4722087b58c5d39aa47 +26ca88ea430fa8315805be4986cb04e6a66ef0293511ffd98c7aeda98240b777
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.