Skip to content

Commit 07f44b7

Browse files
committed
Avoid double copying into provided outbuf
1 parent d25ef40 commit 07f44b7

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

ext/zlib/zlib.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,11 +2961,6 @@ gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf)
29612961
dst = zstream_shift_buffer(&gz->z, len, outbuf);
29622962
gzfile_calc_crc(gz, dst);
29632963

2964-
if (!NIL_P(outbuf)) {
2965-
rb_str_resize(outbuf, RSTRING_LEN(dst));
2966-
memcpy(RSTRING_PTR(outbuf), RSTRING_PTR(dst), RSTRING_LEN(dst));
2967-
dst = outbuf;
2968-
}
29692964
return dst;
29702965
}
29712966

0 commit comments

Comments
 (0)