1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

od: remove Vec::set_len() usage in InputDecoder (#1739)

This commit is contained in:
Alex Lyon 2021-02-23 03:35:17 -08:00 committed by GitHub
parent 7341a1a033
commit 5935876f38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,10 +38,7 @@ impl<'a, I> InputDecoder<'a, I> {
peek_length: usize,
byte_order: ByteOrder,
) -> InputDecoder<I> {
let mut bytes: Vec<u8> = Vec::with_capacity(normal_length + peek_length);
unsafe {
bytes.set_len(normal_length + peek_length);
} // fast but uninitialized
let bytes = vec![0; normal_length + peek_length];
InputDecoder {
input,