summaryrefslogtreecommitdiff
path: root/t/unit-tests/t-reftable-block.c
diff options
context:
space:
mode:
authorDerrick Stolee <stolee@gmail.com>2025-09-05 19:26:16 +0000
committerJunio C Hamano <gitster@pobox.com>2025-09-05 12:32:01 -0700
commit68383ac9d4c90c9b3c7591aa0118d72489599b11 (patch)
tree2b98e26c2029ea0c4dec70ec721564f54381a1d0 /t/unit-tests/t-reftable-block.c
parent9c2262d65dee8c1e3656b01f7db0660181902d2a (diff)
midx-write: use uint32_t for preferred_pack_idx
midx-write.c has the DISABLE_SIGN_COMPARE_WARNINGS macro defined for a few reasons, but the biggest one is the use of a signed preferred_pack_idx member inside the write_midx_context struct. The code currently uses -1 to indicate an unset preferred pack but pack int ids are normally handled as uint32_t. There are also a few loops that search for the preferred pack by name and those iterators will need updates to uint32_t in the next change. For now, replace the use of -1 with a 'NO_PREFERRED_PACK' macro and an equality check. The macro stores the max value of a uint32_t, so we cannot store a preferred pack that appears last in a list of 2^32 total packs, but that's expected to be unreasonable already. Furthermore, with this change we end up extending the range from 2^31 possible packs to 2^32-1. There are some careful things to worry about with initializing the preferred pack in the struct and using that value when searching for a preferred pack that was already incorrect but accidentally working when the index was initialized to zero. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/t-reftable-block.c')
0 files changed, 0 insertions, 0 deletions