summaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-28 14:28:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-28 14:28:11 +0000
commit265dafc58a799594eb1ea6d5cee89f8bb022586a (patch)
tree18f7afa31393a2d81d5a48ebad49ac61afc8e665 /object.c
parentf37febdd09f2a99234a99709c03187921bdad26e (diff)
downloadruby-265dafc58a799594eb1ea6d5cee89f8bb022586a.tar.gz
ruby-265dafc58a799594eb1ea6d5cee89f8bb022586a.tar.xz
ruby-265dafc58a799594eb1ea6d5cee89f8bb022586a.zip
* object.c (rb_cstr_to_dbl): underscores should appear only
between digits. [ruby-dev:28891] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/object.c b/object.c
index afbcd61e2..733f4f88f 100644
--- a/object.c
+++ b/object.c
@@ -2073,8 +2073,8 @@ rb_cstr_to_dbl(const char *p, int badcheck)
errno = 0;
}
if (p == end) {
+ bad:
if (badcheck) {
- bad:
rb_invalid_str(q, "Float()");
}
return d;
@@ -2087,15 +2087,12 @@ rb_cstr_to_dbl(const char *p, int badcheck)
while (*p) {
if (*p == '_') {
/* remove underscores between digits */
+ if (n == buf || !ISDIGIT(n[-1])) goto bad;
+ while (*++p == '_');
if (badcheck) {
- if (n == buf || !ISDIGIT(n[-1])) goto bad;
- ++p;
if (!ISDIGIT(*p)) goto bad;
}
- else {
- while (*++p == '_');
- continue;
- }
+ continue;
}
*n++ = *p++;
}