summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-28 09:47:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-28 09:47:47 +0000
commit97d6e56b0e68d5361809c4571fd1003ee41bffb0 (patch)
treee8bda56e67315da34a5c1d2bdc25692f0d7b46d4 /io.c
parent9b02a72d7183f3a76636f1168429e5d229409c66 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index 15b714560e..5d49f7f9f0 100644
--- a/io.c
+++ b/io.c
@@ -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");
}