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

* io.c (io_binwrite, rb_io_syswrite): use shared frozen source

strings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-02-28 09:47:47 +00:00
parent 9b02a72d71
commit 97d6e56b0e
2 changed files with 8 additions and 1 deletions

View file

@ -1,4 +1,7 @@
Tue Feb 28 18:33:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
Tue Feb 28 18:47:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (io_binwrite, rb_io_syswrite): use shared frozen source
strings.
* io.c (io_fread, io_getpartial, rb_io_sysread): set buffer size
after check if readable, which can cause thread switch.

4
io.c
View file

@ -1243,6 +1243,8 @@ io_write(VALUE io, VALUE str, int nosync)
io = tmp;
if (RSTRING_LEN(str) == 0) return INT2FIX(0);
str = rb_str_new_frozen(str);
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
@ -4219,6 +4221,8 @@ rb_io_syswrite(VALUE io, VALUE str)
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
str = rb_str_new_frozen(str);
if (fptr->wbuf.len) {
rb_warn("syswrite for buffered IO");
}