Skip to content

Commit

Permalink
Avoid double copying into provided outbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Apr 11, 2024
1 parent d25ef40 commit 07f44b7
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions ext/zlib/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,11 +2961,6 @@ gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf)
dst = zstream_shift_buffer(&gz->z, len, outbuf);
gzfile_calc_crc(gz, dst);

if (!NIL_P(outbuf)) {
rb_str_resize(outbuf, RSTRING_LEN(dst));
memcpy(RSTRING_PTR(outbuf), RSTRING_PTR(dst), RSTRING_LEN(dst));
dst = outbuf;
}
return dst;
}

Expand Down

0 comments on commit 07f44b7

Please sign in to comment.