ruby-changes:5596
From: mame <ko1@a...>
Date: Thu, 12 Jun 2008 02:50:23 +0900 (JST)
Subject: [ruby-changes:5596] Ruby:r17102 (trunk): * ext/stringio/stringio.c (strio_init): rewind when reopened.
mame 2008-06-12 02:50:03 +0900 (Thu, 12 Jun 2008) New Revision: 17102 Modified files: trunk/ChangeLog trunk/ext/stringio/stringio.c trunk/test/stringio/test_stringio.rb Log: * ext/stringio/stringio.c (strio_init): rewind when reopened. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17102&r2=17101&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/stringio/test_stringio.rb?r1=17102&r2=17101&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/stringio/stringio.c?r1=17102&r2=17101&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 17101) +++ ChangeLog (revision 17102) @@ -1,3 +1,7 @@ +Thu Jun 12 02:49:40 2008 Yusuke Endoh <mame@t...> + + * ext/stringio/stringio.c (strio_init): rewind when reopened. + Thu Jun 12 02:43:27 2008 Yusuke Endoh <mame@t...> * array.c (rb_ary_zip): ANSI style. Index: ext/stringio/stringio.c =================================================================== --- ext/stringio/stringio.c (revision 17101) +++ ext/stringio/stringio.c (revision 17102) @@ -192,6 +192,8 @@ break; } ptr->string = string; + ptr->pos = 0; + ptr->lineno = 0; } static VALUE Index: test/stringio/test_stringio.rb =================================================================== --- test/stringio/test_stringio.rb (revision 17101) +++ test/stringio/test_stringio.rb (revision 17102) @@ -252,11 +252,11 @@ f = StringIO.new("foo\nbar\nbaz\n") assert_equal("foo\n", f.gets) f.reopen("qux\nquux\nquuux\n") - assert_equal("quux\n", f.gets) + assert_equal("qux\n", f.gets) f2 = StringIO.new("") f2.reopen(f) - assert_equal("quuux\n", f2.gets) + assert_equal("quux\n", f2.gets) ensure f.close unless f.closed? end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/