| Date | Sat, 5 Feb 2011 15:33:41 +0100 | Subject | Re: [PATCH 01/52] kstrtox: converting strings to integers done (hopefully) right | From | Geert Uytterhoeven <> |
| |
On Sat, Feb 5, 2011 at 15:20, Alexey Dobriyan <adobriyan@gmail.com> wrote: > --- /dev/null > +++ b/lib/kstrtox.c > @@ -0,0 +1,227 @@ > +/* > + * Convert integer string representation to an integer. > + * If an integer doesn't fit into specified type, -E is returned.
Which -E? Currently it returns -EINVAL everywhere.
> +int _kstrtoul(const char *s, unsigned int base, unsigned long *res) > +{ > + unsigned long long tmp; > + int rv; > + > + rv = kstrtoull(s, base, &tmp); > + if (rv < 0) > + return rv; > + if (tmp != (unsigned long long)(unsigned long)tmp) > + return -EINVAL;
-ERANGE for out-of-range?
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|