diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-30 13:07:45 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-30 13:07:45 +0000 |
commit | 48925716c49735e751dffaede68a4d9dcef68cc5 (patch) | |
tree | 169ac3689cafe1442dd72d04c4b3d6deefdb15d9 /bignum.c | |
parent | 9d6e9694ee931abde3267805aaf0440c57cf9067 (diff) |
* bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -416,7 +416,7 @@ rb_cstr_to_inum(str, base, badcheck) len = 2; break; case 8: - if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O'||str[1] == '_')) { + if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O')) { str += 2; } case 4: case 5: case 6: case 7: @@ -448,7 +448,14 @@ rb_cstr_to_inum(str, base, badcheck) break; } if (*str == '0') { /* squeeze preceeding 0s */ - while (*++str == '0'); + int us = 0; + while ((c = *++str) == '0' || c == '_') { + if (c == '_') { + if (++us >= 2) + break; + } else + us = 0; + } if (!(c = *str) || ISSPACE(c)) --str; } c = *str; |