midx: factor out `fill_pack_info()`
commitfba68184b8de477934d1642ac1c311cfcf0f6041
authorTaylor Blau <me@ttaylorr.com>
Thu, 14 Dec 2023 22:23:48 +0000 (14 17:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Dec 2023 22:38:07 +0000 (14 14:38 -0800)
tree3dae9962e5c8f46a932a5e784b36dd57bbf42f7b
parenta96015a517060e5b69c6dd428f7276f1078ba507
midx: factor out `fill_pack_info()`

When selecting which packfiles will be written while generating a MIDX,
the MIDX internals fill out a 'struct pack_info' with various pieces of
book-keeping.

Instead of filling out each field of the `pack_info` structure
individually in each of the two spots that modify the array of such
structures (`ctx->info`), extract a common routine that does this for
us.

This reduces the code duplication by a modest amount. But more
importantly, it zero-initializes the structure before assigning values
into it. This hardens us for a future change which will add additional
fields to this structure which (until this patch) was not
zero-initialized.

As a result, any new fields added to the `pack_info` structure need only
be updated in a single location, instead of at each spot within midx.c.

There are no functional changes in this patch.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx.c