summaryrefslogtreecommitdiff
path: root/strings/dtoa.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings/dtoa.c')
-rw-r--r--strings/dtoa.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/strings/dtoa.c b/strings/dtoa.c
index ef1c141ec44..4086bf412fe 100644
--- a/strings/dtoa.c
+++ b/strings/dtoa.c
@@ -1416,20 +1416,27 @@ static double my_strtod_int(const char *s00, char **se, int *error, char *buf, s
c= *++s;
if (!nd)
{
- for (; s < end && c == '0'; c= *++s)
+ for (; s < end; ++s)
+ {
+ c= *s;
+ if (c != '0')
+ break;
nz++;
+ }
if (s < end && c > '0' && c <= '9')
{
s0= s;
nf+= nz;
nz= 0;
- goto have_dig;
}
- goto dig_done;
+ else
+ goto dig_done;
}
- for (; s < end && c >= '0' && c <= '9'; c = *++s)
+ for (; s < end; ++s)
{
- have_dig:
+ c= *s;
+ if (c < '0' || c > '9')
+ break;
/*
Here we are parsing the fractional part.
We can stop counting digits after a while: the extra digits