]> git.ipfire.org Git - thirdparty/git.git/commit
midx.c: use `size_t`'s for fanout nr and alloc
authorTaylor Blau <me@ttaylorr.com>
Wed, 12 Jul 2023 23:37:36 +0000 (19:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jul 2023 16:32:03 +0000 (09:32 -0700)
commite6c71f239d18af3b99af8fa2b68f16cee813d1e2
treef707e65f5640031010e355d8bf72e04b52569359
parenta519abca02eeca7dce864717b9664c62a124e1c0
midx.c: use `size_t`'s for fanout nr and alloc

The `midx_fanout` struct is used to keep track of a set of OIDs
corresponding to each layer of the MIDX's fanout table. It stores an
array of entries, along with the number of entries in the table, and the
allocated size of the array.

Both `nr` and `alloc` are stored as 32-bit unsigned integers. In
practice, this should never cause any problems, since most packs have
far fewer than 2^32-1 objects.

But storing these as `size_t`'s is more appropriate, and prevents us
from accidentally overflowing some result when multiplying or adding to
either of these values. Update these struct members to be `size_t`'s as
appropriate.

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