diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-09 08:00:26 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-09 08:00:26 +0000 |
commit | 8786b8a2823d146fbb382305707a24fc09f25618 (patch) | |
tree | fc1c3806824c1482f652c832070883f6466df100 /string.c | |
parent | d036633dcbfc7c4f7f28feab753694df1265f27d (diff) | |
download | ruby-8786b8a2823d146fbb382305707a24fc09f25618.tar.gz |
* string.c (rb_enc_cr_str_buf_cat): fix self appending.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1132,9 +1132,6 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len, off = ptr - RSTRING_PTR(str); } rb_str_modify(str); - if (off != -1) { - ptr = RSTRING_PTR(str) + off; - } if (len == 0) { ENCODING_CODERANGE_SET(str, res_encindex, res_cr); return str; @@ -1156,6 +1153,9 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len, } RESIZE_CAPA(str, capa); } + if (off != -1) { + ptr = RSTRING_PTR(str) + off; + } memcpy(RSTRING_PTR(str) + RSTRING_LEN(str), ptr, len); STR_SET_LEN(str, total); RSTRING_PTR(str)[total] = '\0'; // sentinel |