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 | 11d0b334b1740d1fa07ed1fcc79c24885d89de1e (patch) | |
| tree | fc1c3806824c1482f652c832070883f6466df100 /string.c | |
| parent | 6f89ce0b6c37d6dad1df0226339977a07776effa (diff) | |
| download | ruby-11d0b334b1740d1fa07ed1fcc79c24885d89de1e.tar.gz ruby-11d0b334b1740d1fa07ed1fcc79c24885d89de1e.tar.xz ruby-11d0b334b1740d1fa07ed1fcc79c24885d89de1e.zip | |
* string.c (rb_enc_cr_str_buf_cat): fix self appending.
git-svn-id: http://svn.ruby-lang.org/repos/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 |
