🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4212

Re: [PATCH 5/5] builtin/multi-pack-index: de-globalize options handling

#4212
From: Justin Tobler
Date: Tue, 01 Dec 2026 17:18
35 lines
11817 bytes
On 26/12/01 11:59AM, Patrick Steinhardt wrote:
> On Mon, Nov 30, 2026 at 03:55:01PM -0600, Justin Tobler wrote:
> > diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
> > index d3881aee6a11..eb5c77456b33 100644
> > --- a/builtin/multi-pack-index.c
> > +++ b/builtin/multi-pack-index.c
> > @@ -214,6 +216,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
> >  
> >  		string_list_clear(&packs, 0);
> >  		free(opts.refs_snapshot);
> > +		free(opts.object_dir);
> >  
> >  		return ret;
> >  
> > @@ -223,6 +226,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
> >  			      opts.refs_snapshot, opts.flags);
> >  
> >  	free(opts.refs_snapshot);
> > +	free(opts.object_dir);
> >  	return ret;
> >  }
> 
> Okay. Now that the options aren't global anymore we of course have to
> free everything they reference. It would have been nice though to unify
> the logic a bit, either by introducing a common return path or by
> introducing a function that releases the memory held on to by `opts`. Or
> both.

With the changes suggested for patch 1, "--object-dir=" no longer needs
to be allocated, and consuently no longer needs to be freed. I'll leave
the existing handling of `refs_snapshot` as-is for now.

Thanks for the review,
-Justin
Technical Details
Message-ID: <aw8A3FPmNwUvMoMC@denethor>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76808-linux-kernel-git=dewy.ru
References: <cover.1796075503.git.jltobler@gmail.com> <d8ac438101939336c17481b18ab8f3636aaabbd5.1796075503.git.jltobler@gmail.com> <aw6onR6DqUkKJmzY@pks.im>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76808-linux-kernel-git=dewy.ru
From: jltobler@gmail.com (Justin Tobler)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH 5/5] builtin/multi-pack-index: de-globalize options
 handling
Date: Tue, 1 Dec 2026 11:18:45 -0600
Organization: Usenet Network
Message-ID: <aw8A3FPmNwUvMoMC@denethor>
References: <cover.1796075503.git.jltobler@gmail.com>
 <d8ac438101939336c17481b18ab8f3636aaabbd5.1796075503.git.jltobler@gmail.com>
 <aw6onR6DqUkKJmzY@pks.im>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1776087"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8nEGOSNYJjehPdtYl+2h/TS/9tU= sha256:P2uGYAUNSHK0aKXWgLI0AKo9cGbv2pdQXmJR7XSmw2Y=
	sha1:JCX1i0QcLBcq5X983VJx3AhtWAc= sha256:UVl/ne4fbM0l9y5mmlxxJlyN91K2wmootvw+q/RyXSo=
Content-Disposition: inline
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4B278117408; Tue,  1 Dec 2026 20:19:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.049
X-Spam-Status: No, score=-2.049 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Qo68Cyk9AwFu;
	Tue,  1 Dec 2026 20:19:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-76808-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8D160117433; Tue,  1 Dec 2026 20:18:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id C7F8128A00; Tue,  1 Dec 2026 17:18:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796145528;
	b=DZZeIdvwvBeHfn9U9N9BPxUA7XOCSlHCVMQuykcejvpsgML8Y3Dxqj4Oxs1qbiZQXssY
	 BeFUxBryyhxJEs3VBmewJDWEYkAgodJDIjt5RMKDQEm4of7LBFCCN9vqe7CD5EcXDXu6r
	 tiWCE4QWGnHwni9+o1tdO+Fb3Ahoh1L6sFzoOig8Xx1dz3eZac98tJHoZYAt5xe1q70if
	 rqU6RZZImg8w9FhYFe54d8+yS30aPYrNGSjxgsY7DjhdM+hNPm2tzNuCBbDFzY3xIKMNb
	 h8r8T38Txjs99e2SdsfKhUWKDJb4aytrXvVXnHjaTNQqCDp46/m+g5ZlJf5XW+cYhNA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796145528;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=thtd/1sEHNsiS1TiXByeSXOcvk3drT0tFh/0ShVWt1Q=;
	b=cKwfK1lBEaKj1HWhZxqGKwK1UL0a2XTUi49atsWGmXFsAw6oF2D00enH7L87ljquk4Cr
	 mWWwP9fRS6dzGVREToFZ1utJ4N+iSoQe3Evp90sXSX/nYIvtyZu8DGq+/19GMSRPT8luD
	 Bqqbxgdtbl50l9uVT4Vnd2F2nbVQUtEDKqnsH407OKIJy+koPJonqaUU8wZCftxpaDt0v
	 tAS4AMN1PhKxCf8F9hY/QI5fo26LYZHRZwL6zBeFgWtpesP0KwKXxZYDWEO/VvxF48xHQ
	 Zu+9FxxtCQXEMC56uOWg4xZRZENjsZgNMCBBzxI+FLIPPgoJ8olNd51HJzupqXy2ROw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uTWhyHFV;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 747F2606A32C;
	Tue,  1 Dec 2026 17:18:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uTWhyHFV
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796145527;
	b=AJCJQGnrGTpLwX43iJhgmBTl/WdBA4u8B08dBqAChCRovz92MXmhlaDYkOi7nVsvX2vS
	 vOedYXDZUCYY9ynPq/skk/kC46UstJXe61qyK8bOuw+DBzh5ppyAFLBPqMpctI3oI7zxU
	 SLxzi5+0/cF9LpKorx0YaeQjdp4XF2HATQbUcpvuo7hHVlrBjxwudyzUGeNyyf0YyKmcO
	 sUOhJH3Fu0DHHNWQVqw1ll/VS435EVcHwKfvMy91MY5BVADpzVvra8c3qNuwTXxUVpIvf
	 u1D5CfLFHa+tdg+WCNGbhkP1+26zuqch0y0C9B0zU1zQokDsu8mRfVWoPU9LpdYYm5g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796145527;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=thtd/1sEHNsiS1TiXByeSXOcvk3drT0tFh/0ShVWt1Q=;
	b=fVYAU9BPMNwddKy8ZQLIu5FjLb42soZLFYu7a+s2ioC9tnoojTH9uQK62tGamz8VRFUz
	 7hBDYSTAb9Ey8FP9mAYL49TcjmDhx1Fiw8rjCayAXbHaX2zH5gFX2AXSZ7y7vb6BPZ5Nd
	 /mDXj1GtbzaXif0TJ9RyuhEu7976nRpk/wryKhAG2EZWL/orwYkVhOTwIamiiSiyj3N44
	 tLhs0w6MZ3rORt+AxDIH0PhM1S/zK1rVGv8CbXHql+cMrOs4bdkiBIvoF13slOgvho/xR
	 KeqqbpcWg0Y81rJY+1DVDacAozqNfcXuQjQ7MYd+KIz5E1Un1n7QS4ghdlJ2fEbvtuQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=uTWhyHFV;
	arc=none smtp.remote-ip=209.85.161.53
X-Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DEB4606A31A
	for <git@vger.kernel.org>; Tue,  1 Dec 2026 17:18:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DEB4606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-71af0656bedso7373978eaf.0
        for <git@vger.kernel.org>; Tue, 01 Dec 2026 09:18:47 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796145526; x=1796750326; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=thtd/1sEHNsiS1TiXByeSXOcvk3drT0tFh/0ShVWt1Q=;
        b=uTWhyHFVn664LOLmGxwQ//ConL6X4T1Hv9nDMobegYX/hYvqfLopH0hxY6fTByscL4
         sH+9q6gXTkClQZ/9yWFuqpEMHHfea035zIgshLt8yWFN9MY17j080hOgJWVx1RrX6xeP
         M5eS1aFu3iSZ0tfC+cAkAZqYSFWRdnl/FzPUIcuXO+HpEEg4SOKt80BGp5AzwAY/Fj0W
         UAHZrletu9iNUI84i1chEWLmV33Oh7Ie+jgBSiOFpLMRM8c9HXkEYlQRu2YQDKKFQ1Zq
         Gvmmf7hzyVZPP4L2klKByBwQSD0ttFeGJImT7FO/BLqk8bDFVmimpR/2F9S8NFfdfNWl
         mAQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796145526; x=1796750326;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=thtd/1sEHNsiS1TiXByeSXOcvk3drT0tFh/0ShVWt1Q=;
        b=W/F7Vs+j5ibJ8qC2ZpL/mEUGzq7/AWAS2d7iTBGaQL87xDkiUiOAc9VKy2MUn906SU
         qK1JqKnsZDHpW+evhwcpWwSi24qWbgpSmSBVfFffnKxcXa257thzUj331aMCjyJpGQhV
         qDO3QLnBfNf3KrRYMhy5W9WtluU3XkRdxawejLRRUidb9C90Olr6Lcr64JcOtlNofkYt
         RXcvJh6yozw82AcUsCEVL8FMOmFEv9A3JScL+HK+Xhc/L76kvrVqEj20oY8STefJ6caJ
         fiuB1xt9n/ILOQ6oNUpAG9BcJcXBl7QT1HirAWicj0d72hZxgq91NgMEWzVhb6rJ+RUX
         lnpA==
X-Gm-Message-State: APuU4Z97aFMvj48KwvqRgoIbm2+YHI9ulj6ZK4BQDdMaKAsCnk5LPR92
	AnBM7CdptQ8ic+0Ylc1UX38y1YjyPqkv1fXlXRXxlNQOfF1DBWSwBi5f6iNkPw==
X-Gm-Gg: AZFdTZeQzzfvq7lKtTF+c8AVipPeuLIbpz7wlbE3ck37iX0MtzyHMzdKY90gRI55tz/
	ItUshgNBJem3Xu0NiLBVc+UNvUCrW8jwDPySYBSa7lQNhNEDbtGFxt6OIuVdTIXaQndjLwRKET1
	XMsH/qjDqADh/DW5WmQt70FFk1/ACE4F5tr3FfuY+1vGso1rlLtSRzuBMj+O4INQ0kOs53uPK40
	/LLwowu18vQP8VW3q9ruGlkSO2tp9sZVln4XWsoSi/smyWmOkxYLzU9dfKlcp0F8OK5PU3nubxi
	tZOnVhj8KNfHs6uDeJPrv/JcZeowAd+0b92xND9YkaCEHlLd7iSmObHR/e86sv8xxtrgt9ocCks
	pawRUckkuVHPcFdi/+yWuhXVLtXGpvIHSzPdSWVqRQD3UE6xcjC7rKl10/uu4B2QTzjYHSfhuZM
	yVQru1Nsvkjau/UnNwPYAXtj1gcC1Rtkmrk3w7U85iSSaBQ/WtxxXcu7nR1OLpLFuQi7WINWm+N
	uoevZgZWoTSeGg+j7KKGe4aMUdfGjxP6g4bpT8oC3AXoNJYopWBTRRZA0y/8tYA7gZmJXk+hlfr
	2pcNFN0wJYXqlQBwiMTl1pGpyg/ixIhXq+Tmnu9L1i9wdrwgnUT9
X-Received: by 2002:a05:6820:1344:b0:71a:f121:3f7b with SMTP id 006d021491bc7-71b3955c796mr30062001eaf.68.1796145526100;
        Tue, 01 Dec 2026 09:18:46 -0800 (PST)
X-Received: from localhost ([136.51.44.64])
        by smtp.gmail.com with ESMTPSA id 006d021491bc7-71bbfc14667sm3902064eaf.5.2026.12.01.09.18.45
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 01 Dec 2026 09:18:45 -0800 (PST)
X-Cc: git@vger.kernel.org
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <aw6onR6DqUkKJmzY@pks.im>