From: "Denis Vlasenko" <vda.linux@googlemail.com>
To: "Alexey Dobriyan" <adobriyan@gmail.com>
Cc: "Satyam Sharma" <satyam@infradead.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] Introduce strtol_check_range()
Date: Thu, 2 Aug 2007 11:13:15 +0100 [thread overview]
Message-ID: <1158166a0708020313r22201c3bm722ec5bb050e609b@mail.gmail.com> (raw)
In-Reply-To: <20070802042528.GA5797@martell.zuzino.mipt.ru>
On 8/2/07, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > > Please, copy strtonum() from BSD instead. Nobody needs another
> > > home-grown converter.
> >
> > BSD's strtonum(3) is a detestful, horrible shame.
> >
> > The strtol_check_range() I implemented here does _all_ that strtonum()
> > does, plus is generic w.r.t. base,
>
> What you did with base argument is creating opportunity to fsckup,
> namely, forgetting that base is last and putting it second.
Embedding base in function name (func10, func8, func16 [, func2])
will eliminate that possibility and also save one argument
push on stack.
You can always multiplex them locally:
static int func_generic(base...) {...}
int func10(...) { return func_generic(10, ....); }
int func8(...) { return func_generic(8, ....); }
You also can have a faster "static int func_power_of_2(base...)" for
2,8,16, etc.
--
vda
next prev parent reply other threads:[~2007-08-02 10:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-31 16:34 Satyam Sharma
2007-07-31 19:02 ` Andrew Morton
2007-08-01 5:35 ` Alexey Dobriyan
2007-08-01 23:46 ` Satyam Sharma
2007-08-02 0:22 ` Satyam Sharma
2007-08-02 4:25 ` Alexey Dobriyan
2007-08-02 10:13 ` Denis Vlasenko [this message]
2007-08-03 7:59 ` Jan Engelhardt
2007-08-03 8:59 ` Satyam Sharma
2007-08-04 22:49 ` Alexey Dobriyan
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=1158166a0708020313r22201c3bm722ec5bb050e609b@mail.gmail.com \
--to=vda.linux@googlemail.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=satyam@infradead.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®