summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-23 03:19:58 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-23 03:19:58 (GMT)
commit815ab02971f7b94e276823f407b8fc2723bf703b (patch)
tree018e801bbf4fbe5d45fb855024a4165b6bd0c6bd /util.c
parent54f344095916f83a2755a177f94e65a1c390a612 (diff)
* util.c (ruby_strtod): make sure to have digit-sequence after 'p'
for hexadecimal-floating-constant. [ruby-dev:42105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util.c b/util.c
index 76ba457..762d97f 100644
--- a/util.c
+++ b/util.c
@@ -2141,11 +2141,15 @@ break2:
if (abs(dsign) == 1) s++;
else dsign = 1;
- for (nd = 0; (c = *s) >= '0' && c <= '9'; s++) {
+ nd = 0;
+ c = *s;
+ if (c < '0' || '9' < c) goto ret0;
+ do {
nd *= 10;
nd += c;
nd -= '0';
- }
+ c = *++s;
+ } while ('0' <= c && c <= '9');
dval(rv) = ldexp(adj, nd * dsign);
}
else {