]> git.ipfire.org Git - thirdparty/git.git/commit
commit-reach: use `size_t` to track indices in `remove_redundant()`
authorPatrick Steinhardt <ps@pks.im>
Fri, 27 Dec 2024 10:46:24 +0000 (11:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Dec 2024 16:11:45 +0000 (08:11 -0800)
commit45843d8f4eb2bbfc73cc361ba9d612d088dc8a4f
treed1a6f5c1cbb3352ef9eef8e3d0a2607e4ba905fa
parent04aeeeaab1f02213703c4e1997b2c2f1ca0f8f96
commit-reach: use `size_t` to track indices in `remove_redundant()`

The function `remove_redundant()` gets as input an array of commits as
well as the size of that array and then drops redundant commits from
that array. It then returns either `-1` in case an error occurred, or
the new number of items in the array.

The function receives and returns these sizes with a signed integer,
which causes several warnings with -Wsign-compare. Fix this issue by
consistently using `size_t` to track array indices and splitting up
the returned value into a returned error code and a separate out pointer
for the new computed size.

Note that `get_merge_bases_many()` and related functions still track
array sizes as a signed integer. This will be fixed in a subsequent
commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-reach.c