git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 4/4] transport: mark unused parameters in fetch_refs_from_bundle()
Date: Fri, 17 Mar 2023 15:17:18 -0400	[thread overview]
Message-ID: <ZBS8vt97YJj3wMxn@coredump.intra.peff.net> (raw)
In-Reply-To: <ZBS77VYL9ZrxKtCN@coredump.intra.peff.net>

We don't look at the "to_fetch" or "nr_heads" parameters at all. At
first glance this seems like a bug (or at least pessimisation), because
it means we fetch more objects from the bundle than we actually need.
But the bundle does not have any way of computing the set of reachable
objects itself (we'd have to pull all of the objects out to walk them).
And anyway, we've probably already paid most of the cost of grabbing the
objects, since we must copy the bundle locally before accessing it.

So it's perfectly reasonable for the bundle code to just pull everything
into the local object store. Unneeded objects can be dropped later via
gc, etc.

But we should mark these unused parameters as such to avoid the wrath of
-Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
---
 transport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/transport.c b/transport.c
index 81950bf755f..c5abf26f31e 100644
--- a/transport.c
+++ b/transport.c
@@ -167,7 +167,8 @@ static struct ref *get_refs_from_bundle(struct transport *transport,
 }
 
 static int fetch_refs_from_bundle(struct transport *transport,
-			       int nr_heads, struct ref **to_fetch)
+				  int nr_heads UNUSED,
+				  struct ref **to_fetch UNUSED)
 {
 	struct bundle_transport_data *data = transport->data;
 	struct strvec extra_index_pack_args = STRVEC_INIT;
-- 
2.40.0.581.g8d688c70eca

  parent reply	other threads:[~2023-03-17 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 19:13 [PATCH 0/4] more unused-parameter fixes Jeff King
2023-03-17 19:16 ` [PATCH 1/4] mailmap: drop debugging code Jeff King
2023-03-17 20:08   ` Eric Sunshine
2023-03-17 21:13     ` Jeff King
2023-03-17 19:16 ` [PATCH 2/4] http: drop unused parameter from start_object_request() Jeff King
2023-03-17 19:17 ` [PATCH 3/4] http: mark unused parameter in fill_active_slot() callbacks Jeff King
2023-03-17 19:17 ` Jeff King [this message]
2023-03-17 20:28   ` [PATCH 4/4] transport: mark unused parameters in fetch_refs_from_bundle() Junio C Hamano

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=ZBS8vt97YJj3wMxn@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    /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).