1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (io_read): duplicate string if shared. [ruby-dev:42719]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tarui 2010-12-07 13:38:36 +00:00
parent 11ef87461a
commit 9865ee2c46
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Tue Dec 7 22:37:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
* io.c (io_read): duplicate string if shared. [ruby-dev:42719]
Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Dec 7 22:31:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (OptionParser::Officious): separate completion * lib/optparse.rb (OptionParser::Officious): separate completion

5
io.c
View file

@ -2212,7 +2212,10 @@ io_read(int argc, VALUE *argv, VALUE io)
rb_scan_args(argc, argv, "02", &length, &str); rb_scan_args(argc, argv, "02", &length, &str);
if (NIL_P(length)) { if (NIL_P(length)) {
if (!NIL_P(str)) StringValue(str); if (!NIL_P(str)){
StringValue(str);
rb_str_modify(str);
}
GetOpenFile(io, fptr); GetOpenFile(io, fptr);
rb_io_check_char_readable(fptr); rb_io_check_char_readable(fptr);
return read_all(fptr, remain_size(fptr), str); return read_all(fptr, remain_size(fptr), str);