Hopefully in some not so distant future, we'll get advantages from always
initializing the "repo" member of the "struct index_state". To make
that easier let's introduce an initialization macro & function.
The various ad-hoc initialization of the structure can then be changed
over to it, and we can remove the various "0" assignments in
discard_index() in favor of calling index_state_init() at the end.
While not strictly necessary, let's also change the CALLOC_ARRAY() of
various "struct index_state *" to use an ALLOC_ARRAY() followed by
We're then adding the release_index() function and converting some
callers (including some of these allocations) over to it if they
either won't need to use their "struct index_state" again, or are just
about to call index_state_init().
Signed-off-by: Ævar Arnfjörð Bjarmason <firstname.lastname@example.org>
Acked-by: Derrick Stolee <email@example.com>
Signed-off-by: Junio C Hamano <firstname.lastname@example.org>
This commit is contained in:
Ævar Arnfjörð Bjarmason2023-01-12 13:55:27 +01:00committed byJunio C Hamano