X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrtod.c;h=fdfc09f1bc0ca61909db5116774e57d134d5b896;hb=0730a6cdc74a97b1b5b507c0be6116cc0967c056;hp=161f97a7b1894e074e6e7452a8332f63929ed9ea;hpb=fa9635f22ac175bace582885ca780d3eb511b578;p=gnulib.git diff --git a/lib/strtod.c b/lib/strtod.c index 161f97a7b..fdfc09f1b 100644 --- a/lib/strtod.c +++ b/lib/strtod.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1997, 1999, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1997, 1999, 2003, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,29 +12,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H -# include -#endif +#include #include -#ifndef errno -extern int errno; -#endif #include -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) -#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c)) -#define TOLOWER(c) (IN_CTYPE_DOMAIN (c) ? tolower(c) : (c)) - #include #include @@ -67,7 +52,7 @@ strtod (const char *nptr, char **endptr) s = nptr; /* Eat whitespace. */ - while (ISSPACE (*s)) + while (isspace ((unsigned char) *s)) ++s; /* Get the sign. */ @@ -81,7 +66,7 @@ strtod (const char *nptr, char **endptr) exponent = 0; for (;; ++s) { - if (ISDIGIT (*s)) + if ('0' <= *s && *s <= '9') { got_digit = 1; @@ -114,7 +99,7 @@ strtod (const char *nptr, char **endptr) if (!got_digit) goto noconv; - if (TOLOWER (*s) == 'e') + if (tolower ((unsigned char) *s) == 'e') { /* Get the exponent specified after the `e' or `E'. */ int save = errno;