summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-18 11:46:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-18 11:46:02 +0000
commit549e0e488eba4c7710cf5b63d6e319415244bf60 (patch)
tree2258c0aad7e7f94d3e042ff5acc9533bd907551f /ext
parent39fe6aa3045ef5638660a6fa81d60f41741d08d5 (diff)
zlib.c: return unshared string
* ext/zlib/zlib.c (zstream_shift_buffer): create new copied string since it cannot be shared ever. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 824dd13..db09af6 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -814,8 +814,7 @@ zstream_shift_buffer(struct zstream *z, long len)
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);