From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E13F137F736 for ; Mon, 30 Mar 2026 22:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774911236; cv=none; b=vGnm894N6pzNH68QZL4LMXa5wK4K58z2PQflMO3yYKLiKAJZy5uM+3O/jPzDzAF3a33A3E39ndOJkhk11zWgmiZiPmzMS2uFiPr3aghshwJzsMoA2bzmOd1QjyKFTJAsET1bv4tZxw/+ABlzF5Xo6vEvTt1KTJqWAyKag7u6SdY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774911236; c=relaxed/simple; bh=3rLDiEvUtfcZPzes8X99XZBS42xU6iDrDmKdspRmb2E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=tVhAI2xetnPt/m9v+s0UGkjT/p2V7OECDA1P06qnBLuLlkvNh72TNSuMfWXcu+Z7/zEKpDMPXTHF3ZKpJls1SEAnDRs5BPE9JBGby1o8HnYVK1ZBxcCB4qYS5l2zyOaGE9Cp7CXKZ81GQ0rBPIGBldLhkUy8t2vDRk+MYwHMNPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=YoGGD8D+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=xMz0f5Rp; arc=none smtp.client-ip=103.168.172.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="YoGGD8D+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="xMz0f5Rp" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 5A90BEC026C; Mon, 30 Mar 2026 18:53:47 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-04.internal (MEProxy); Mon, 30 Mar 2026 18:53:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1774911227; x=1774997627; bh=orEtD2SUmV V8IjArWwFfKXuOPwLiG/h1GIKatega1Oc=; b=YoGGD8D+ApCVs5AhQ2w3nBuHS9 kNUmXgmRXDNgfmBfgmnnuDG7A60LAuenMjUgUO6IOFamS35loASvxTN/u7CF0xBc Ir7Mm8gwcor9NKdxmYx9B3+XRMSWirQawjj/PLMiubi1xMtu8dXXTB6otDqs//ra TySWZXI7yzg6rNEn3z1kSuN8echTaOyKui6tq+HfNmqKB2pCHmEi0MViEfj0bxH9 gVIXAwZhnsyv1E1R2y7BKFBoONv/7LwMR7A10ci7TOTeDsF58si6jLm4myqxmZZ9 SX50MR4IqsfewhcwB3BmxC6ofeiJrb8OyQZLIkSLrO7cYpqs3sRXHhY762aw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1774911227; x=1774997627; bh=orEtD2SUmVV8IjArWwFfKXuOPwLiG/h1GIK atega1Oc=; b=xMz0f5RpqmcnYdqLczbgK4a/FjbPkyHxf7PKi54scEKAP/Tjnhq QBIttCsdgfJRl/aLF9nzeffmhRwOxKtU2kqZLkccWsiVYY/0O21CqhkECxIbz4/u 45e5AhC5fGJy556k6SGxrTDjzfkSS9P0zHUn+wnyOBjxkxKU2qZMvgz2bg1IruET 7MDD7AyDCgB2N+RW2haggg9YU/bWe7N89t8dHiqMwFPYe9bX6aX39gFMC4smAs65 DHLNB5nLehGLWBRFXOlt3WzT/wc/hLibHtwy8zWRdDpAHiFDI1jyVaJ+xTgm+FGM JyJnIy9JwDnNyFyTRgWwZBQXZToPa6uFfBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefgedtvdefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkfgggtgesthdtredttdertdenucfhrhhomheplfhunhhiohcu vecujfgrmhgrnhhouceoghhithhsthgvrhesphhosghogidrtghomheqnecuggftrfgrth htvghrnhepfeevteetjeehueegffelvdetieevffeufeejleeuffetiefggfeftdfhfeei geeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepgh hithhsthgvrhesphhosghogidrtghomhdpnhgspghrtghpthhtohepledpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhgihhtghgrughgvghtsehgmhgrihhlrdgtoh hmpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthho peihtghhihhnrdhgihhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhhihhllhhiph drfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehlrdhsrdhrseifvggs rdguvgdprhgtphhtthhopehpvghffhesphgvfhhfrdhnvghtpdhrtghpthhtohepsggvnh drkhhnohgslhgvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepvgiivghkihgvlhhnvgif rhgvnhesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtshhtvghrsehpohgsohigrd gtohhm X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Mar 2026 18:53:46 -0400 (EDT) From: Junio C Hamano To: "Ezekiel Newren via GitGitGadget" Cc: git@vger.kernel.org, Yee Cheng Chin , Phillip Wood , =?utf-8?Q?Ren=C3=A9?= Scharfe , Jeff King , "D. Ben Knoble" , Ezekiel Newren Subject: Re: [PATCH v4 1/6] xdiff/xdl_cleanup_records: delete local recs pointer In-Reply-To: (Ezekiel Newren via GitGitGadget's message of "Mon, 30 Mar 2026 16:59:58 +0000") References: Date: Mon, 30 Mar 2026 15:53:45 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Ezekiel Newren via GitGitGadget" writes: > From: Ezekiel Newren > > Simplify the first 2 for loops by directly indexing the xdfile.recs. > recs is unused in the last 2 for loops, remove it. Best viewed with > --color-words. > > Signed-off-by: Ezekiel Newren > --- > xdiff/xprepare.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) Interesting that the latter loops did not even have to have the extra pointer variable. Nice clean-up. > > diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c > index cd4fc405eb..d6e1901d2d 100644 > --- a/xdiff/xprepare.c > +++ b/xdiff/xprepare.c > @@ -269,7 +269,6 @@ static bool xdl_clean_mmatch(uint8_t const *action, long i, long s, long e) { > */ > static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xdf2) { > long i, nm, mlim; > - xrecord_t *recs; > xdlclass_t *rcrec; > uint8_t *action1 = NULL, *action2 = NULL; > bool need_min = !!(cf->flags & XDF_NEED_MINIMAL); > @@ -293,16 +292,18 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd > */ > if ((mlim = xdl_bogosqrt((long)xdf1->nrec)) > XDL_MAX_EQLIMIT) > mlim = XDL_MAX_EQLIMIT; > - for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart]; i <= xdf1->dend; i++, recs++) { > - rcrec = cf->rcrecs[recs->minimal_perfect_hash]; > + for (i = xdf1->dstart; i <= xdf1->dend; i++) { > + size_t mph1 = xdf1->recs[i].minimal_perfect_hash; > + rcrec = cf->rcrecs[mph1]; > nm = rcrec ? rcrec->len2 : 0; > action1[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP; > } > > if ((mlim = xdl_bogosqrt((long)xdf2->nrec)) > XDL_MAX_EQLIMIT) > mlim = XDL_MAX_EQLIMIT; > - for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart]; i <= xdf2->dend; i++, recs++) { > - rcrec = cf->rcrecs[recs->minimal_perfect_hash]; > + for (i = xdf2->dstart; i <= xdf2->dend; i++) { > + size_t mph2 = xdf2->recs[i].minimal_perfect_hash; > + rcrec = cf->rcrecs[mph2]; > nm = rcrec ? rcrec->len1 : 0; > action2[i] = (nm == 0) ? DISCARD: (nm >= mlim && !need_min) ? INVESTIGATE: KEEP; > } > @@ -312,8 +313,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd > * false, or become true. > */ > xdf1->nreff = 0; > - for (i = xdf1->dstart, recs = &xdf1->recs[xdf1->dstart]; > - i <= xdf1->dend; i++, recs++) { > + for (i = xdf1->dstart; i <= xdf1->dend; i++) { > if (action1[i] == KEEP || > (action1[i] == INVESTIGATE && !xdl_clean_mmatch(action1, i, xdf1->dstart, xdf1->dend))) { > xdf1->reference_index[xdf1->nreff++] = i; > @@ -324,8 +324,7 @@ static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t *xd > } > > xdf2->nreff = 0; > - for (i = xdf2->dstart, recs = &xdf2->recs[xdf2->dstart]; > - i <= xdf2->dend; i++, recs++) { > + for (i = xdf2->dstart; i <= xdf2->dend; i++) { > if (action2[i] == KEEP || > (action2[i] == INVESTIGATE && !xdl_clean_mmatch(action2, i, xdf2->dstart, xdf2->dend))) { > xdf2->reference_index[xdf2->nreff++] = i;