]> git.ipfire.org Git - thirdparty/git.git/commit
midx-write: reenable signed comparison errors
authorDerrick Stolee <stolee@gmail.com>
Fri, 5 Sep 2025 19:26:17 +0000 (19:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Sep 2025 19:32:01 +0000 (12:32 -0700)
commit1f2bc6be1dbbda5bc40a23bd58a60bbee9de7401
treeee00ae226d9f09a9d8f1bdd54c0cc44b2535db77
parent68383ac9d4c90c9b3c7591aa0118d72489599b11
midx-write: reenable signed comparison errors

Remove the remaining signed comparison warnings in midx-write.c so that
they can be enforced as errors in the future. After the previous change,
the remaining errors are due to iterator variables named 'i'.

The strategy here involves defining the variable within the for loop
syntax to make sure we use the appropriate bitness for the loop
sentinel. This matters in at least one method where the variable was
compared to uint32_t in some loops and size_t in others.

While adjusting these loops, there were some where the loop boundary was
checking against a uint32_t value _plus one_. These were replaced with
non-strict comparisons, but also the value is checked to not be
UINT32_MAX. Since the value is the number of incremental multi-pack-
indexes, this is not a meaningful restriction. The new die() is about
defensive programming more than it being realistically possible.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c