All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alexey Dobriyan <adobriyan@mail.ru>
Cc: Rusty Russell <rusty@rustcorp.com.au>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] futex: s/0/NULL/ in pointer context
Date: Sun, 9 Jan 2005 15:19:28 +0100	[thread overview]
Message-ID: <200501091519.33202.arnd@arndb.de> (raw)
In-Reply-To: <200501091123.31402.adobriyan@mail.ru>

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

On Sünndag 09 Januar 2005 10:23, Alexey Dobriyan wrote:
> @@ -236,7 +236,7 @@
>   */
>  static inline void get_key_refs(union futex_key *key)
>  {
> -	if (key->both.ptr != 0) {
> +	if (key->both.ptr != NULL) {
>  		if (key->both.offset & 1)
>  			atomic_inc(&key->shared.inode->i_count);
>  		else

Actually, many consider the preferred way to write this

	if (key->both.ptr) {

instead, since the condition you want to check is 'is key->both.ptr
a valid pointer', not 'is key->both.ptr inequal to the invalid
pointer'. The normal use for NULL is only in assignments and 
initializations, not in comparisons.

	Arnd <><

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2005-01-09 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-09  9:23 [PATCH] futex: s/0/NULL/ in pointer context Alexey Dobriyan
2005-01-09 14:19 ` Arnd Bergmann [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=200501091519.33202.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=adobriyan@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.