list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <>
To: "Ævar Arnfjörð Bjarmason" <>
Cc:, Junio C Hamano <>
Subject: Re: [PATCH 5/5] streaming.c: move {open,close,read} from vtable to "struct git_istream"
Date: Wed, 5 May 2021 09:55:33 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, May 05, 2021 at 02:33:32PM +0200, Ævar Arnfjörð Bjarmason wrote:

> Move the definition of the structure around the open/close/read
> functions introduced in 46bf043807c (streaming: a new API to read from
> the object store, 2011-05-11) to instead populate "close" and "read"
> members in the "struct git_istream".
> This gets us rid of an extra pointer deference, and I think makes more
> sense. The "close" and "read" functions are the primary interface to
> the stream itself.
> Let's also populate a "open" callback in the same struct. That's now
> used by open_istream() after istream_source() decides what "open"
> function should be used. This isn't needed to get rid of the
> "stream_vtbl" variables, but makes sense for consistency.

Yeah, I think if we are going to get rid of the open vtable in an earlier
patch, it makes sense to go all the way here and make things consistent.

If we had a bunch of these objects, having the layer of indirection to
the vtable would save us some per-object memory. But we really only ever
have one of these open at a time.


  reply	other threads:[~2021-05-05 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 12:33 [PATCH 0/5] streaming.c: refactor for smaller + easier to understand code Ævar Arnfjörð Bjarmason
2021-05-05 12:33 ` [PATCH 1/5] streaming.c: avoid forward declarations Ævar Arnfjörð Bjarmason
2021-05-05 12:33 ` [PATCH 2/5] streaming.c: remove enum/function/vtbl indirection Ævar Arnfjörð Bjarmason
2021-05-05 13:42   ` Jeff King
2021-05-06  0:14     ` Junio C Hamano
2021-05-05 12:33 ` [PATCH 3/5] streaming.c: remove {open,close,read}_method_decl() macros Ævar Arnfjörð Bjarmason
2021-05-05 13:44   ` Jeff King
2021-05-05 12:33 ` [PATCH 4/5] streaming.c: stop passing around "object_info *" to open() Ævar Arnfjörð Bjarmason
2021-05-05 13:49   ` Jeff King
2021-05-05 12:33 ` [PATCH 5/5] streaming.c: move {open,close,read} from vtable to "struct git_istream" Ævar Arnfjörð Bjarmason
2021-05-05 13:55   ` Jeff King [this message]
2021-05-05 13:57 ` [PATCH 0/5] streaming.c: refactor for smaller + easier to understand code Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).