git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
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: <YJKj1bVEfWOWrvhs@coredump.intra.peff.net> (raw)
In-Reply-To: <patch-5.5-52606cd72ac-20210505T122816Z-avarab@gmail.com>

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.

-Peff

  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=YJKj1bVEfWOWrvhs@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://80x24.org/mirrors/git.git

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).