From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC36EC433DF for ; Fri, 15 May 2020 18:42:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 971DD2076A for ; Fri, 15 May 2020 18:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726525AbgEOSma (ORCPT ); Fri, 15 May 2020 14:42:30 -0400 Received: from cloud.peff.net ([104.130.231.41]:48064 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726238AbgEOSma (ORCPT ); Fri, 15 May 2020 14:42:30 -0400 Received: (qmail 26205 invoked by uid 109); 15 May 2020 18:42:30 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Fri, 15 May 2020 18:42:30 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 14273 invoked by uid 111); 15 May 2020 18:42:30 -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, 15 May 2020 14:42:30 -0400 Authentication-Results: peff.net; auth=none Date: Fri, 15 May 2020 14:42:29 -0400 From: Jeff King To: Christian Couder Cc: git@vger.kernel.org, Junio C Hamano , Derrick Stolee , Taylor Blau , Jonathan Tan , Jonathan Nieder , Christian Couder Subject: Re: [PATCH 13/13] upload-pack: use upload_pack_data fields in receive_needs() Message-ID: <20200515184229.GL3692649@coredump.intra.peff.net> References: <20200515100454.14486-1-chriscool@tuxfamily.org> <20200515100454.14486-14-chriscool@tuxfamily.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200515100454.14486-14-chriscool@tuxfamily.org> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, May 15, 2020 at 12:04:54PM +0200, Christian Couder wrote: > As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' > more thoroughly, let's use fields from this struct in > receive_needs(), instead of local variables with the same name > and purpose. OK, makes sense. These are purely local in v0, but it's nice for us to match v2 better (rather than somebody looking at v0 wondering why data.shallows is never used). > - if (send_shallow_list(&data->writer, depth, deepen_rev_list, deepen_since, > - &deepen_not, deepen_relative, &shallows, > + if (send_shallow_list(&data->writer, > + data->depth, > + data->deepen_rev_list, > + data->deepen_since, > + &data->deepen_not, > + data->deepen_relative, > + &data->shallows, > &data->want_obj)) > packet_flush(1); > - object_array_clear(&shallows); > } We can drop this final cleanup step because it's now covered by upload_pack_data_clear(). I wondered if any callers would care that we don't clear it until later, but I guess it couldn't possibly matter: they would not have had access to this "shallows" variable in the first place, since it was local. So this is obviously correct. -Peff