commit-graph: use size_t for array allocation and indexing

Our packed_commit_list is an array of pointers to commit structs. We use "int" for the allocation, which is 32-bit even on 64-bit platforms. This isn't likely to overflow in practice (we're writing commit graphs, so you'd need to actually have billions of unique commits in the repository). But it's good practice to use size_t for allocations. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 7, 2020 at 14:11 UTC 3361390cbedc962adcddcfd98676695c125fa180
1 file changed +2 -2
commit-graph.c
+2 -2
@@ -932,8 +932,8 @@ struct tree *get_commit_tree_in_graph(struct repository *r, const struct commit
932
933 struct packed_commit_list {
934 struct commit **list;
935 - int nr;
936 - int alloc;
935 + size_t nr;
936 + size_t alloc;
937 };
938
939 struct write_commit_graph_context {