diff options
| author | Taylor Blau <me@ttaylorr.com> | 2023-12-14 17:23:48 -0500 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-12-14 14:38:07 -0800 |
| commit | fba68184b8de477934d1642ac1c311cfcf0f6041 (patch) | |
| tree | 3dae9962e5c8f46a932a5e784b36dd57bbf42f7b /builtin/commit.c | |
| parent | pack-bitmap: plug leak in find_objects() (diff) | |
| download | git-fba68184b8de477934d1642ac1c311cfcf0f6041.tar.gz git-fba68184b8de477934d1642ac1c311cfcf0f6041.zip | |
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>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions
