From: Jonathan Ho <jonathanho15@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: kernel lib parser: cleaned up code and fixed redundancies
Date: Tue, 28 Dec 2004 16:41:09 -0800 [thread overview]
Message-ID: <41D1FD25.3020403@gmail.com> (raw)
Just cleaned up code and fixed variable assignment redundancies.
Signed-off-by: <jonathanho15@gmail.com>
----------------------------------
--- linux-2.6.10/lib/parser.c.orig Fri Dec 24 13:34:33 2004
+++ linux-2.6.10/lib/parser.c Tue Dec 28 12:35:38 2004
@@ -104,8 +104,7 @@ int match_token(char *s, match_table_t t
{
struct match_token *p;
- for (p = table; !match_one(s, p->pattern, args) ; p++)
- ;
+ for (p = table; !match_one(s, p->pattern, args); p++);
return p->token;
}
@@ -122,9 +121,8 @@ int match_token(char *s, match_table_t t
*/
static int match_number(substring_t *s, int *result, int base)
{
- char *endp;
- char *buf;
- int ret;
+ char *endp, *buf;
+ int ret = 0;
buf = kmalloc(s->to - s->from + 1, GFP_KERNEL);
if (!buf)
@@ -132,7 +130,6 @@ static int match_number(substring_t *s,
memcpy(buf, s->from, s->to - s->from);
buf[s->to - s->from] = '\0';
*result = simple_strtol(buf, &endp, base);
- ret = 0;
if (endp == buf)
ret = -EINVAL;
kfree(buf);
next reply other threads:[~2004-12-29 0:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-29 0:41 Jonathan Ho [this message]
2004-12-29 1:03 ` Jesper Juhl
2004-12-29 7:36 ` Christoph Hellwig
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=41D1FD25.3020403@gmail.com \
--to=jonathanho15@gmail.com \
--cc=linux-kernel@vger.kernel.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®