diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-22 14:14:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-22 14:14:30 +0000 |
commit | a197581765fa78c848f3d49233f47ec2e8fc90c0 (patch) | |
tree | 5ef26a507eb2c6e1515120252f1893979572c26b /ext/stringio/stringio.c | |
parent | c143b9a0ab2f6fd48bb46932329766d9b619b9bf (diff) |
stringio.c: use rb_str_append
* ext/stringio/stringio.c (strio_write): use rb_str_append to
reuse coderange bits and keep taintedness.
[ruby-dev:48118] [Bug #9769]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r-- | ext/stringio/stringio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index e964e79e12..dbd5a287c4 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -1170,7 +1170,6 @@ strio_write(VALUE self, VALUE str) long len, olen; rb_encoding *enc, *enc2; - RB_GC_GUARD(str); if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); enc = rb_enc_get(ptr->string); @@ -1186,7 +1185,7 @@ strio_write(VALUE self, VALUE str) ptr->pos = olen; } if (ptr->pos == olen) { - rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc); + rb_str_append(ptr->string, str); } else { strio_extend(ptr, ptr->pos, len); @@ -1194,6 +1193,7 @@ strio_write(VALUE self, VALUE str) OBJ_INFECT(ptr->string, str); } OBJ_INFECT(ptr->string, self); + RB_GC_GUARD(str); ptr->pos += len; return LONG2NUM(len); } |