From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 813511F428 for ; Fri, 17 Mar 2023 19:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbjCQTRf (ORCPT ); Fri, 17 Mar 2023 15:17:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbjCQTR3 (ORCPT ); Fri, 17 Mar 2023 15:17:29 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A14F21C7F2 for ; Fri, 17 Mar 2023 12:17:20 -0700 (PDT) Received: (qmail 25999 invoked by uid 109); 17 Mar 2023 19:17:19 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 17 Mar 2023 19:17:19 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27517 invoked by uid 111); 17 Mar 2023 19:17:18 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 17 Mar 2023 15:17:18 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 17 Mar 2023 15:17:18 -0400 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 4/4] transport: mark unused parameters in fetch_refs_from_bundle() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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 --- 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