ruby-changes:4309
From: ko1@a...
Date: Wed, 19 Mar 2008 14:37:06 +0900 (JST)
Subject: [ruby-changes:4309] nobu - Ruby:r15799 (trunk, ruby_1_8): * bignum.c (rb_cstr_to_inum): treat successive underscores as
nobu 2008-03-19 14:36:43 +0900 (Wed, 19 Mar 2008) New Revision: 15799 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/bignum.c trunk/ChangeLog trunk/bignum.c trunk/test/ruby/test_string.rb Log: * bignum.c (rb_cstr_to_inum): treat successive underscores as nondigit. [ruby-dev:34089] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_string.rb?r1=15799&r2=15798&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=15799&r2=15798&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15799&r2=15798&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bignum.c?r1=15799&r2=15798&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/bignum.c?r1=15799&r2=15798&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15798) +++ ChangeLog (revision 15799) @@ -1,3 +1,8 @@ +Wed Mar 19 14:36:40 2008 Nobuyoshi Nakada <nobu@r...> + + * bignum.c (rb_cstr_to_inum): treat successive underscores as + nondigit. [ruby-dev:34089] + Wed Mar 19 14:08:47 2008 Nobuyoshi Nakada <nobu@r...> * encoding.c (enc_check_encoding): should not load autoloaded encoding Index: bignum.c =================================================================== --- bignum.c (revision 15798) +++ bignum.c (revision 15799) @@ -532,10 +532,11 @@ for (i=len;i--;) zds[i]=0; while ((c = *str++) != 0) { if (c == '_') { - if (badcheck) { - if (nondigit) goto bad; - nondigit = c; + if (nondigit) { + if (badcheck) goto bad; + break; } + nondigit = c; continue; } else if ((c = conv_digit(c)) < 0) { Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 15798) +++ test/ruby/test_string.rb (revision 15799) @@ -1213,7 +1213,7 @@ assert_equal(12, "1_2".to_i(10)) assert_equal(0x40000000, "1073741824".to_i(10)) assert_equal(0x4000000000000000, "4611686018427387904".to_i(10)) - assert_equal(12, "1__2".to_i(10)) + assert_equal(1, "1__2".to_i(10)) assert_equal(1, "1_z".to_i(10)) end Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 15798) +++ ruby_1_8/ChangeLog (revision 15799) @@ -1,3 +1,8 @@ +Wed Mar 19 14:36:40 2008 Nobuyoshi Nakada <nobu@r...> + + * bignum.c (rb_cstr_to_inum): treat successive underscores as + nondigit. [ruby-dev:34089] + Wed Mar 19 00:01:23 2008 Masatoshi SEKI <m_seki@m...> * lib/erb.rb (ERB::Compiler): Make some minor code optimization. Index: ruby_1_8/bignum.c =================================================================== --- ruby_1_8/bignum.c (revision 15798) +++ ruby_1_8/bignum.c (revision 15799) @@ -512,10 +512,11 @@ for (i=len;i--;) zds[i]=0; while ((c = *str++) != 0) { if (c == '_') { - if (badcheck) { - if (nondigit) goto bad; - nondigit = c; + if (nondigit) { + if (badcheck) goto bad; + break; } + nondigit = c; continue; } else if ((c = conv_digit(c)) < 0) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/