Skip to content

Commit 95c09e4

Browse files
pks-tgitster
authored andcommitted
commit-reach: fix index used to loop through unsigned integer
In 62e745c (prio-queue: use size_t rather than int for size, 2024-12-20), we refactored `struct prio_queue` to track the number of contained entries via a `size_t`. While the refactoring adapted one of the users of that variable, it forgot to also adapt "commit-reach.c" accordingly. This was missed because that file has -Wsign-conversion disabled. Fix the issue by using a `size_t` to iterate through entries. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 44945df commit 95c09e4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

commit-reach.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ static int compare_commits_by_gen(const void *_a, const void *_b)
4242

4343
static int queue_has_nonstale(struct prio_queue *queue)
4444
{
45-
int i;
46-
for (i = 0; i < queue->nr; i++) {
45+
for (size_t i = 0; i < queue->nr; i++) {
4746
struct commit *commit = queue->array[i].data;
4847
if (!(commit->object.flags & STALE))
4948
return 1;

0 commit comments

Comments
 (0)