diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-14 08:56:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-14 08:56:11 +0000 |
commit | 8e7a682be04ac9060f1957ea12a84d2aeb7374c9 (patch) | |
tree | 5a03bc9ee01d30108e4611b866029a9250872e4e /io.c | |
parent | 95c52c8e6c2e0ac8ea690ca8ae5141a0fde49e24 (diff) |
* io.c (io_shift_cbuf): should terminate.
http://golf.shinh.org/p.rb?DECimal+number+to+BINary#Ruby
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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; |