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 | |
parent | 95c52c8e6c2e0ac8ea690ca8ae5141a0fde49e24 (diff) | |
download | ruby-8e7a682be04ac9060f1957ea12a84d2aeb7374c9.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | io.c | 5 |
2 files changed, 6 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Wed Apr 14 17:56:06 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (io_shift_cbuf): should terminate. + http://golf.shinh.org/p.rb?DECimal+number+to+BINary#Ruby + Wed Apr 14 16:29:02 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * gc.c (GET_STACK_BOUNDS): fixed macro argument names. a patch from @@ -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; |