mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (io_strsetbuf): call rb_str_modify to make str independent
before calling rb_str_set_len for r34580. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ff4c13688e
commit
7eed0ca619
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Feb 15 17:41:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@segment7.net>
|
Wed Feb 15 12:30:10 2012 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that
|
* ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that
|
||||||
|
|
5
io.c
5
io.c
|
@ -2084,7 +2084,10 @@ io_setstrbuf(VALUE *str, long len)
|
||||||
VALUE s = StringValue(*str);
|
VALUE s = StringValue(*str);
|
||||||
long clen = RSTRING_LEN(s);
|
long clen = RSTRING_LEN(s);
|
||||||
if (clen >= len) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
len -= clen;
|
len -= clen;
|
||||||
|
|
Loading…
Add table
Reference in a new issue