diff options
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 |