ruby-changes:33544
From: nobu <ko1@a...>
Date: Fri, 18 Apr 2014 20:46:13 +0900 (JST)
Subject: [ruby-changes:33544] nobu:r45625 (trunk): zlib.c: return unshared string
nobu 2014-04-18 20:46:02 +0900 (Fri, 18 Apr 2014) New Revision: 45625 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45625 Log: zlib.c: return unshared string * ext/zlib/zlib.c (zstream_shift_buffer): create new copied string since it cannot be shared ever. Modified files: trunk/ext/zlib/zlib.c Index: ext/zlib/zlib.c =================================================================== --- ext/zlib/zlib.c (revision 45624) +++ ext/zlib/zlib.c (revision 45625) @@ -814,8 +814,7 @@ zstream_shift_buffer(struct zstream *z, https://github.com/ruby/ruby/blob/trunk/ext/zlib/zlib.c#L814 return zstream_detach_buffer(z); } - dst = rb_str_subseq(z->buf, 0, len); - rb_obj_reveal(dst, rb_cString); + dst = rb_str_new(RSTRING_PTR(z->buf), len); z->buf_filled -= len; memmove(RSTRING_PTR(z->buf), RSTRING_PTR(z->buf) + len, z->buf_filled); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/