diff options
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -438,7 +438,7 @@ rb_cstr_to_inum(const char *str, int base, int 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: @@ -470,8 +470,16 @@ rb_cstr_to_inum(const char *str, int base, int badcheck) break; } if (*str == '0') { /* squeeze preceding 0s */ - while (*++str == '0'); - if (!(c = *str) || ISSPACE(c)) --str; + int nn = 0; + while ((c = *++str) == '0' || c == '_') { + if (c == '_') { + nn++; + if (nn >= 2) + break; + } else + nn = 0; + } + if (!(c = *str) || ISSPACE(c)) --str; } c = *str; c = conv_digit(c); |