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>
maint
Jeff King 2020-12-07 14:11:08 -05:00 committed by Junio C Hamano
parent a5f1c44899
commit 3361390cbe
1 changed files with 2 additions and 2 deletions

View File

@ -932,8 +932,8 @@ struct tree *get_commit_tree_in_graph(struct repository *r, const struct commit


struct packed_commit_list { struct packed_commit_list {
struct commit **list; struct commit **list;
int nr; size_t nr;
int alloc; size_t alloc;
}; };


struct write_commit_graph_context { struct write_commit_graph_context {