Re: [PATCH 4/5] streaming.c: stop passing around "object_info *" to open()
From: Jeff King <hidden>
Date: 2021-05-05 13:49:54
On Wed, May 05, 2021 at 02:33:31PM +0200, Ævar Arnfjörð Bjarmason wrote:
Change the streaming interface to stop passing around the "struct object_info" the open() functions. As seen in 7ef2d9a2604 (streaming: read non-delta incrementally from a pack, 2011-05-13) which introduced the "st->u.in_pack" assignments being changed here only the open_istream_pack_non_delta() path need these. So let's instead do this when preparing the selected callback in the istream_source() function. This might also allow the compiler to reduce the lifetime of the "oi" variable, as we've moved it from "git_istream()" to "istream_source()".
OK. This blurs the lines a bit between what the generic istream_source() is responsible for, versus the type-specific helpers. I think that works a bit against the original design, which was trying to be very abstract and polymorphic. But that doesn't seem to have bought us much. Just considering the whole set of streaming code as a module with helper functions is a bit simpler and more usual for our codebase. So I'm OK with it unless Junio (as the original author) has strong objections. -Peff