mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_buf_append): improvement for non-broken coded
strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5a1cf1c5cb
commit
7f59e105d1
2 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Dec 22 08:29:56 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_buf_append): improvement for non-broken coded
|
||||
strings.
|
||||
|
||||
Sat Dec 22 06:30:04 2007 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* bootstraptest/test_fork.rb: skip if fork is not unsupported.
|
||||
|
|
12
string.c
12
string.c
|
@ -1009,8 +1009,17 @@ rb_str_buf_append(VALUE str, VALUE str2)
|
|||
{
|
||||
rb_encoding *enc;
|
||||
long capa, len;
|
||||
int cr1, cr2;
|
||||
|
||||
enc = rb_enc_check(str, str2);
|
||||
cr1 = ENC_CODERANGE(str);
|
||||
cr2 = ENC_CODERANGE(str2);
|
||||
if (cr1 == ENC_CODERANGE_BROKEN || cr2 == ENC_CODERANGE_BROKEN) {
|
||||
cr1 = ENC_CODERANGE_UNKNOWN;
|
||||
}
|
||||
else if (cr2 > cr1) {
|
||||
cr1 = cr2;
|
||||
}
|
||||
rb_str_modify(str);
|
||||
if (STR_ASSOC_P(str)) {
|
||||
FL_UNSET(str, STR_ASSOC);
|
||||
|
@ -1034,6 +1043,9 @@ rb_str_buf_append(VALUE str, VALUE str2)
|
|||
STR_SET_LEN(str, len);
|
||||
OBJ_INFECT(str, str2);
|
||||
rb_enc_associate(str, enc);
|
||||
if (cr1 != ENC_CODERANGE_UNKNOWN) {
|
||||
ENC_CODERANGE_SET(str, cr1);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue