]> git.ipfire.org Git - thirdparty/git.git/commit
pathspec: fix sign comparison warnings
authorArnav Bhate <bhatearnav@gmail.com>
Sun, 30 Mar 2025 17:45:06 +0000 (23:15 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Apr 2025 09:51:47 +0000 (02:51 -0700)
commit6d29175c0f321f64a90385a2a3dab63ba8c76358
treed5ae528285061dd724520c68b75624b11dc32c45
parent683c54c999c301c2cd6f715c411407c413b1d84e
pathspec: fix sign comparison warnings

There are multiple places, especially in loops, where a signed and an
unsigned data type are compared. Git uses a mix of signed and unsigned
types to store lengths of arrays. This sometimes leads to using a signed
index for an array whose length is stored in an unsigned variable or
vice versa. In some cases, where both signed and unsigned data types
have been used to store lengths of arrays in the same function, only
one variable was used to iterate over both types.

Replace signed data types with unsigned data types and vice versa
wherever necessary. Where both types of iterators are required, move
the declaration inside the for loop. In cases where this is not
possible, add appropriate cast.

Remove #define DISABLE_SIGN_COMPARE_WARNINGS.

Signed-off-by: Arnav Bhate <bhatearnav@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pathspec.c