summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 09:33:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-22 09:33:32 +0000
commit6ade3a42918e94be1c6d4b1bd9273ec1e3265525 (patch)
treeda7457f2fcb5bf5c357658edcf971f0285c0fc8a /string.c
parent456f3980b20ca031a2925094feff86ceb0032b8e (diff)
* string.c (rb_str_inspect): append for each chars instead of bulk
copy if encoding conversion is needed. [ruby-core:33283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index 20466e16f2..307056cee7 100644
--- a/string.c
+++ b/string.c
@@ -4238,8 +4238,10 @@ rb_str_inspect(VALUE str)
(cc == '$' || cc == '@' || cc == '{')))) {
if (p - n > prev) str_buf_cat(result, prev, p - n - prev);
str_buf_cat2(result, "\\");
- prev = p - n;
- continue;
+ if (enc == resenc) {
+ prev = p - n;
+ continue;
+ }
}
switch (c) {
case '\n': cc = 'n'; break;