X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fstrtod.c;h=6b69ccfa8d206c6594c7b668362a85fbf7b120a6;hb=23b7362fd74b2ac828e9bb7c0251aaa144948757;hp=c86c73de9b3870c5a4d40dc7aa5e663ca4870740;hpb=30727aa6d12fb866494020c0b62ab265a2bdcdfe;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/strtod.c b/libiberty/strtod.c index c86c73de9b..6b69ccfa8d 100644 --- a/libiberty/strtod.c +++ b/libiberty/strtod.c @@ -22,7 +22,23 @@ the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ -#include +/* + +@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr}) + +This ISO C function converts the initial portion of @var{string} to a +@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the +character after the last character used in the conversion is stored in +the location referenced by @var{endptr}. If no conversion is +performed, zero is returned and the value of @var{string} is stored in +the location referenced by @var{endptr}. + +@end deftypefn + +*/ + +#include "ansidecl.h" +#include "safe-ctype.h" extern double atof (); @@ -42,7 +58,7 @@ strtod (str, ptr) p = str; - while (isspace (*p)) + while (ISSPACE (*p)) ++p; if (*p == '+' || *p == '-') @@ -88,10 +104,10 @@ strtod (str, ptr) } /* digits, with 0 or 1 periods in it. */ - if (isdigit (*p) || *p == '.') + if (ISDIGIT (*p) || *p == '.') { int got_dot = 0; - while (isdigit (*p) || (!got_dot && *p == '.')) + while (ISDIGIT (*p) || (!got_dot && *p == '.')) { if (*p == '.') got_dot = 1; @@ -105,9 +121,9 @@ strtod (str, ptr) i = 1; if (p[i] == '+' || p[i] == '-') ++i; - if (isdigit (p[i])) + if (ISDIGIT (p[i])) { - while (isdigit (p[i])) + while (ISDIGIT (p[i])) ++i; *ptr = p + i; return atof (str);