mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Deepak Saxena <dsaxena@mvista.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	linux-kernel@vger.kernel.org, marcelo.tosatti@cyclades.com.br
Subject: Re: [PATCH] Fix %x parsing in vsscanf()
Date: Wed, 24 Sep 2003 01:55:26 +0100	[thread overview]
Message-ID: <20030924005526.GQ7665@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20030924010258.GA24014@xanadu.az.mvista.com>

On Tue, Sep 23, 2003 at 06:02:58PM -0700, Deepak Saxena wrote:
> On Sep 23 2003, at 23:26, viro@parcelfarce.linux.theplanet.co.uk was caught saying:
> > The following, AFAICS, would be correct:
> > 
> >         if (*cp == '0') {
> >                 cp++;
> >                 if (unlikely((*cp == 'x' || *cp == 'X') && isxdigit(cp[1]))) {
> >                         if (!base || base == 16) {
> >                                 cp++;
> >                                 base = 16;
> >                         }
> >                 } else if (!base)
> >                         base = 8;
> >         } else if (!base)
> >                 base = 10;
> 
> We can remove everything but "base = 10;" from the second "else if"
> clause b/c by this point we're guaranteed that it's not a hex or
> octal value.

Bzzert.  strtoul() with e.g. base 8 on "1234" should parse it as octal.

      reply	other threads:[~2003-09-24  0:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-23 21:22 Deepak Saxena
2003-09-23 21:26 ` viro
2003-09-23 21:28 ` Linus Torvalds
2003-09-23 21:35   ` viro
2003-09-23 22:16     ` Deepak Saxena
2003-09-23 22:26       ` viro
2003-09-24  1:02         ` Deepak Saxena
2003-09-24  0:55           ` viro [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=20030924005526.GQ7665@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=dsaxena@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com.br \
    --cc=torvalds@osdl.org \
    /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®