X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fxstrtol.c;h=906e4a1cc1e936ae56211365ce892050c8d1f62d;hb=f7b2e38dd51606dab99c4c7f6a456e93efd13591;hp=32149397c28d9981507362522c3dc0313d308017;hpb=790855e18a1dc027c0fb770de72a28081bc677fb;p=gnulib.git diff --git a/lib/xstrtol.c b/lib/xstrtol.c index 32149397c..906e4a1cc 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003 Free + Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -37,15 +37,10 @@ #include #include -#include -#include - #include -#ifndef errno -extern int errno; -#endif - #include +#include +#include /* The extra casts work around common compiler bugs. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) @@ -121,9 +116,10 @@ __xstrtol (const char *s, char **ptr, int strtol_base, if (! TYPE_SIGNED (__strtol_t)) { const char *q = s; - while (ISSPACE ((unsigned char) *q)) - ++q; - if (*q == '-') + unsigned char ch = *q; + while (ISSPACE (ch)) + ch = *++q; + if (ch == '-') return LONGINT_INVALID; } @@ -248,7 +244,6 @@ __xstrtol (const char *s, char **ptr, int strtol_base, default: *val = tmp; return err | LONGINT_INVALID_SUFFIX_CHAR; - break; } err |= overflow;