about summary refs log tree commit diff
path: root/stdlib/strtod.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-01-24 22:10:30 +0000
committerUlrich Drepper <drepper@redhat.com>2001-01-24 22:10:30 +0000
commitac259c27be2057cd323eb2113d213065a4517121 (patch)
tree28dac47ce86c166bd22608ff556f439ea2bc2f91 /stdlib/strtod.c
parent99f1b15bd12249169a0fc125fc6daab4f8c4f48b (diff)
downloadglibc-ac259c27be2057cd323eb2113d213065a4517121.tar.gz
glibc-ac259c27be2057cd323eb2113d213065a4517121.tar.xz
glibc-ac259c27be2057cd323eb2113d213065a4517121.zip
(str_to_mpn): Correct parsing of thousands separators.
Diffstat (limited to 'stdlib/strtod.c')
-rw-r--r--stdlib/strtod.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 62a4c9996e..f9ffa444e0 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -1,6 +1,6 @@
 /* Read decimal floating point numbers.
    This file is part of the GNU C Library.
-   Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -349,12 +349,13 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
 #else
       if (*str < '0' || *str > '9')
 	{
+	  int inner = 0;
 	  if (thousands != NULL && *str == *thousands
-	      && ({ for (cnt == 1; thousands[cnt] != '\0'; ++cnt)
-		      if (thousands[cnt] != str[cnt])
+	      && ({ for (inner = 1; thousands[inner] != '\0'; ++inner)
+		      if (thousands[inner] != str[inner])
 			break;
-		    thousands[cnt] == '\0'; }))
-	    str += cnt;
+		    thousands[inner] == '\0'; }))
+	    str += inner;
 	  else
 	    str += decimal_len;
 	}