Re: [PATCH v2 1/5] submodule-config.h: remove unused SUBMODULE_INIT macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 27, 2021 at 02:54:24PM +0200, Ævar Arnfjörð Bjarmason wrote:

> This macro was added and used in c68f8375760 (implement fetching of
> moved submodules, 2017-10-16) but its last user went away in
> be76c212823 (fetch: ensure submodule objects fetched, 2018-12-06).
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  submodule-config.h | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/submodule-config.h b/submodule-config.h
> index c11e22cf509..65875b94ea5 100644
> --- a/submodule-config.h
> +++ b/submodule-config.h
> @@ -45,10 +45,6 @@ struct submodule {
>  	struct object_id gitmodules_oid;
>  	int recommend_shallow;
>  };
> -
> -#define SUBMODULE_INIT { NULL, NULL, NULL, RECURSE_SUBMODULES_NONE, \
> -	NULL, NULL, SUBMODULE_UPDATE_STRATEGY_INIT, { { 0 } }, -1 };

I was a bit surprised by this one, just because we generally prefer the
builtin initializers to init functions. And even if we are only using
the latter, I like the move to implementing it in terms of the former.

But this struct is extra funny, as now it will have neither. It comes
only from submodule_from_name() or submodule_from_path(), which in turn
are building up from config and the initialization in
lookup_or_create_by_name(). And keeping those two in sync is potentially
error-prone.

So this whole "make a submodule struct on the stack" thing is pretty odd
in the first place, and I'm happy to see this initializer going away.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux