mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: CodingStyle: provide good example
Date: Mon, 4 Feb 2008 15:51:09 -0800	[thread overview]
Message-ID: <20080204155109.fee3e5e0.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080204234343.GA1901@elf.ucw.cz>

On Tue, 5 Feb 2008 00:43:43 +0100
Pavel Machek <pavel@ucw.cz> wrote:

> if (!buffer) is actually prefered style, so lets use it in example.
> 
> 								Pavel
> 
> Signed-off-by: Pavel Machek <pavel@suse.cz>
> 
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index 6caa146..9bb2d8a 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -406,7 +415,7 @@ int fun(int a)
>  	int result = 0;
>  	char *buffer = kmalloc(SIZE);
>  
> -	if (buffer == NULL)
> +	if (!buffer)
>  		return -ENOMEM;
>  
>  	if (condition1) {

I tend to avoid preferring one over the other unless the extra seven
columns is needed to prevent wraparound nasties.

  reply	other threads:[~2008-02-04 23:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-04 23:43 Pavel Machek
2008-02-04 23:51 ` Andrew Morton [this message]
2008-02-05  0:21 ` Jan Engelhardt

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=20080204155109.fee3e5e0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®