Skip to content

Commit 44945df

Browse files
pks-tgitster
authored andcommitted
prio-queue: fix type of insertion_ctr
In 62e745c (prio-queue: use size_t rather than int for size, 2024-12-20), we have converted `struct prio_queue` to use `size_t` to track the number of entries in the queue as well as the allocated size of the underlying array. There is one more counter though, namely the insertion counter, that is still using an `unsigned` instead of a `size_t`. This is unlikely to ever be a problem, but it makes one wonder why some indices use `size_t` while others use `unsigned`. Furthermore, the mentioned commit stated the intent to also adapt these variables, but seemingly forgot to do so. Fix the issue by converting those counters to use `size_t`, as well. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 76cf4f6 commit 44945df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prio-queue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
typedef int (*prio_queue_compare_fn)(const void *one, const void *two, void *cb_data);
2323

2424
struct prio_queue_entry {
25-
unsigned ctr;
25+
size_t ctr;
2626
void *data;
2727
};
2828

2929
struct prio_queue {
3030
prio_queue_compare_fn compare;
31-
unsigned insertion_ctr;
31+
size_t insertion_ctr;
3232
void *cb_data;
3333
size_t alloc, nr;
3434
struct prio_queue_entry *array;

0 commit comments

Comments
 (0)