summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 05:33:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-14 05:33:40 +0000
commit925cc8ffd010df19a044875df252e939eaf0a8da (patch)
tree99c81610a8ed39748ea0318b409611c13c650627 /string.c
parent9aa67e267b9c8d84e49464ea6f83e6f31c38efca (diff)
string.c: keep source code range
* string.c (rb_enc_cr_str_buf_cat): keep code range of the source string even if code range of the destination string is unknown. no reason to the former is affected by the latter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/string.c b/string.c
index 28b1efa2e9..227424d266 100644
--- a/string.c
+++ b/string.c
@@ -2090,9 +2090,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
str_cr = RSTRING_LEN(str) ? ENC_CODERANGE(str) : ENC_CODERANGE_7BIT;
if (str_encindex == ptr_encindex) {
- if (str_cr == ENC_CODERANGE_UNKNOWN)
- ptr_cr = ENC_CODERANGE_UNKNOWN;
- else if (ptr_cr == ENC_CODERANGE_UNKNOWN) {
+ if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) {
ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex));
}
}