aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/io.c b/io.c
index 2656b2bae8..3afa413183 100644
--- a/io.c
+++ b/io.c
@@ -1698,11 +1698,8 @@ io_shift_cbuf(rb_io_t *fptr, int len, VALUE *strp)
*strp = str = rb_str_new(fptr->cbuf+fptr->cbuf_off, len);
}
else {
- size_t slen;
str = *strp;
- slen = RSTRING_LEN(str);
- rb_str_resize(str, RSTRING_LEN(str) + len);
- memcpy(RSTRING_PTR(str)+slen, fptr->cbuf+fptr->cbuf_off, len);
+ rb_str_cat(str, fptr->cbuf+fptr->cbuf_off, len);
}
fptr->cbuf_off += len;
fptr->cbuf_len -= len;