mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib: fix scnprintf() if @size is == 0
Date: Tue, 24 Aug 2010 17:35:43 -0700	[thread overview]
Message-ID: <1282696543.25208.29.camel@Joe-Laptop> (raw)
In-Reply-To: <AANLkTinfjGB_1CaWNQHynFWK5Tki9BJCW3oeOaY68py9@mail.gmail.com>

On Wed, 2010-08-25 at 08:10 +0800, Changli Gao wrote:
> On Wed, Aug 25, 2010 at 8:03 AM, Joe Perches <joe@perches.com> wrote:
> > Isn't simpler to check size at the beginning of the function?
> It is a rare case, so don't slow down the normal users.

That's fine, but I don't like blinking that much
when I read code.

How about:

	if (i < size)
		return i;
	if (size)
		return i - 1;
	return 0;


  reply	other threads:[~2010-08-25  0:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 23:35 Changli Gao
2010-08-25  0:03 ` Joe Perches
2010-08-25  0:10   ` Changli Gao
2010-08-25  0:35     ` Joe Perches [this message]
2010-08-25  0:44       ` Changli Gao

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=1282696543.25208.29.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaosuo@gmail.com \
    /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®