summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-27 16:15:22 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-06-27 16:15:22 +0000
commit30492d9d53f1d79c1713f3ed4e7c623cd1490884 (patch)
treed1a1a231217f995729fe6bdc6d0b5a62579689ce /bignum.c
parent471e41ec70e18339f72539a6331dcf2fb80d2238 (diff)
* object.c (rb_cstr_to_dbl): should not skip '_' at the beginning
of a string. [ruby-dev:28830] * bignum.c (rb_cstr_to_inum): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/bignum.c b/bignum.c
index 2bd44c2bf9..f06444d8dd 100644
--- a/bignum.c
+++ b/bignum.c
@@ -313,12 +313,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (badcheck) goto bad;
return INT2FIX(0);
}
- if (badcheck) {
- while (ISSPACE(*str)) str++;
- }
- else {
- while (ISSPACE(*str) || *str == '_') str++;
- }
+ while (ISSPACE(*str)) str++;
if (str[0] == '+') {
str++;
@@ -408,7 +403,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
unsigned long val = strtoul(str, &end, base);
- if (*end == '_') goto bigparse;
+ if (str < end && *end == '_') goto bigparse;
if (badcheck) {
if (end == str) goto bad; /* no number */
while (*end && ISSPACE(*end)) end++;