summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-03-31 09:04:53 -0400
committerAndrew Kaster <andrewdkaster@gmail.com>2023-03-31 08:44:30 -0600
commitc3b8b3124c545fec7e8b09f446ee21635d410247 (patch)
treefa986ce5b9e97bb9f2950e9138edb0558d888768 /Userland/Libraries
parent88d64fcb553fa2c95b0153649d5fcc1db99d75f8 (diff)
downloadserenity-c3b8b3124c545fec7e8b09f446ee21635d410247.zip
LibCompress: Remove two needless heap allocations
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibCompress/Deflate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCompress/Deflate.cpp b/Userland/Libraries/LibCompress/Deflate.cpp
index 44d010b6f0..0246f18a42 100644
--- a/Userland/Libraries/LibCompress/Deflate.cpp
+++ b/Userland/Libraries/LibCompress/Deflate.cpp
@@ -362,8 +362,9 @@ void DeflateDecompressor::close()
ErrorOr<ByteBuffer> DeflateDecompressor::decompress_all(ReadonlyBytes bytes)
{
- auto memory_stream = TRY(try_make<FixedMemoryStream>(bytes));
- auto deflate_stream = TRY(DeflateDecompressor::construct(make<LittleEndianInputBitStream>(move(memory_stream))));
+ FixedMemoryStream memory_stream { bytes };
+ LittleEndianInputBitStream bit_stream { MaybeOwned<Stream>(memory_stream) };
+ auto deflate_stream = TRY(DeflateDecompressor::construct(MaybeOwned<LittleEndianInputBitStream>(bit_stream)));
AllocatingMemoryStream output_stream;
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));