perf(read): Remove unecessary allocation in read_xl_meta_no_data (#1846)

Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
evan slack
2026-02-16 06:08:12 -05:00
committed by GitHub
parent d19edd9a2c
commit 229f0f89c8
+4 -2
View File
@@ -2712,7 +2712,8 @@ pub async fn read_xl_meta_no_data<R: AsyncRead + Unpin>(reader: &mut R, size: us
if minor < 2 {
read_more(reader, &mut buf, size, want, has_full).await?;
return Ok(buf[..want].to_vec());
buf.truncate(want);
return Ok(buf);
}
let want_max = usize::min(want + MSGP_UINT32_SIZE, size);
@@ -2728,7 +2729,8 @@ pub async fn read_xl_meta_no_data<R: AsyncRead + Unpin>(reader: &mut R, size: us
want += tmp.len() - other_size;
Ok(buf[..want].to_vec())
buf.truncate(want);
Ok(buf)
}
_ => Err(Error::other(std::io::Error::new(
std::io::ErrorKind::InvalidData,