git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 4/5] streaming.c: stop passing around "object_info *" to open()

From
Jeff King <peff@peff.net>
Date
May 5, 2021, 13:49 UTC
Message-ID
<YJKigIfSXWavM0QN@coredump.intra.peff.net>
In-Reply-To
<patch-4.5-44e79d6cb66-20210505T122816Z-avarab@gmail.com>
On Wed, May 05, 2021 at 02:33:31PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> 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
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 11 of 12 in “streaming.c: refactor for smaller + easier to understand code”
  1. 0/5 streaming.c: refactor for smaller + easier to understand codeÆvar Arnfjörð Bjarmason, May 5, 2021
  2. 1/5 streaming.c: avoid forward declarationsÆvar Arnfjörð Bjarmason, May 5, 2021
  3. 3/5 streaming.c: remove {open,close,read}_method_decl() macrosÆvar Arnfjörð Bjarmason, May 5, 2021
  4. Jeff KingMay 5, 2021
  5. 2/5 streaming.c: remove enum/function/vtbl indirectionÆvar Arnfjörð Bjarmason, May 5, 2021
  6. Jeff KingMay 5, 2021
  7. Junio C HamanoMay 6, 2021
  8. 5/5 streaming.c: move {open,close,read} from vtable to "struct git_istream"Ævar Arnfjörð Bjarmason, May 5, 2021
  9. Jeff KingMay 5, 2021
  10. 4/5 streaming.c: stop passing around "object_info *" to open()Ævar Arnfjörð Bjarmason, May 5, 2021
  11. Jeff KingMay 5, 2021
  12. Jeff KingMay 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.