diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | bignum.c | 11 |
2 files changed, 13 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Wed Jan 30 22:06:54 2008 Tadayoshi Funaba <tadf@dotrb.org> + + * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation. + Tue Jan 29 22:40:12 2008 Yusuke Endoh <mame@tsg.ne.jp> * range.c (step_i): rb_funcall receives VALUE as an argument. @@ -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; |