kernel lib parser: cleaned up code and fixed redundancies

From: Jonathan Ho
Date: Tue Dec 28 2004 - 19:42:37 EST


Just cleaned up code and fixed variable assignment redundancies.

Signed-off-by: <jonathanho15@xxxxxxxxx>

----------------------------------

--- 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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/