ruby-changes:22575
From: naruse <ko1@a...>
Date: Wed, 15 Feb 2012 17:47:22 +0900 (JST)
Subject: [ruby-changes:22575] naruse:r34624 (trunk): * io.c (io_strsetbuf): call rb_str_modify to make str independent
naruse 2012-02-15 17:45:15 +0900 (Wed, 15 Feb 2012) New Revision: 34624 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34624 Log: * io.c (io_strsetbuf): call rb_str_modify to make str independent before calling rb_str_set_len for r34580. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 34623) +++ ChangeLog (revision 34624) @@ -1,3 +1,8 @@ +Wed Feb 15 17:41:31 2012 NARUSE, Yui <naruse@r...> + + * io.c (io_strsetbuf): call rb_str_modify to make str independent + before calling rb_str_set_len for r34580. + Wed Feb 15 12:30:10 2012 Eric Hodel <drbrain@s...> * ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that Index: io.c =================================================================== --- io.c (revision 34623) +++ io.c (revision 34624) @@ -2084,7 +2084,10 @@ VALUE s = StringValue(*str); long clen = RSTRING_LEN(s); if (clen >= len) { - if (clen != len) rb_str_set_len(s, len); + if (clen != len) { + rb_str_modify(s); + rb_str_set_len(s, len); + } return; } len -= clen; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/