lkml.org 
[lkml]   [2011]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 01/52] kstrtox: converting strings to integers done (hopefully) right
From
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/

\
 
 \ /
  Last update: 2011-02-05 15:35    [W:0.522 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site