From 4f310d2b64e03a3f87f9e444ed777f57655726dc Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 19 Jun 2022 10:05:35 +0000 Subject: ripple/fossil: box the bao decoder Shuffling 3k around on the stack doesn't make anyone happy. Change-Id: I444fc22267380d9b99ca63ca148b9a9e85238b5a --- ripple/fossil/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ripple/fossil/src/lib.rs b/ripple/fossil/src/lib.rs index 85943f0..6420437 100644 --- a/ripple/fossil/src/lib.rs +++ b/ripple/fossil/src/lib.rs @@ -294,7 +294,8 @@ impl Store { }) .collect(); - Some(Blob(bao::decode::Decoder::new_outboard( + // the decoder is almost 3k in size, so boxing it seems preferable + Some(Blob(Box::new(bao::decode::Decoder::new_outboard( RawBlob { store: self, chunks, @@ -303,11 +304,11 @@ impl Store { }, io::Cursor::new(bao_inline), &ident, - ))) + )))) } } -pub struct Blob<'a>(bao::decode::Decoder, std::io::Cursor>>); +pub struct Blob<'a>(Box, std::io::Cursor>>>); impl io::Read for Blob<'_> { fn read(&mut self, buf: &mut [u8]) -> io::Result { -- cgit 1.4.1