Skip to content

Commit

Permalink
[ruby/zlib] Avoid double copying into provided outbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins authored and matzbot committed May 14, 2024
1 parent e33336c commit e3e1e53
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 e3e1e53

Please sign in to comment.