summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 18:44:48 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-22 18:44:48 +0000
commit506c6f52b950c131b305456cf72fe8f84a2a8f5f (patch)
tree5c3f01f7e8dc014ec2401bac825309234bd0e518 /ext/stringio
parent7804656eb8252e223fce3b35da8a13c9f32392a9 (diff)
Revert r45670 "stringio.c: use rb_str_append"
It breaks test-all. http://u64b.rubyci.org/~chkbuild/ruby-trunk/log/20140422T143301Z.diff.html.gz rb_str_conv_enc() return original string for example when from ASCII-8BIT to UTF-8 with non ASCII strings git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r--ext/stringio/stringio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index dbd5a28..e964e79 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -1170,6 +1170,7 @@ 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);
@@ -1185,7 +1186,7 @@ strio_write(VALUE self, VALUE str)
ptr->pos = olen;
}
if (ptr->pos == olen) {
- rb_str_append(ptr->string, str);
+ rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc);
}
else {
strio_extend(ptr, ptr->pos, len);
@@ -1193,7 +1194,6 @@ 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);
}