summaryrefslogtreecommitdiff
path: root/commit-graph.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-12-07 19:11:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-07 20:32:04 (GMT)
commit3361390cbedc962adcddcfd98676695c125fa180 (patch)
treea1e0134536a215471e6b68516e624f7c830495a7 /commit-graph.c
parenta5f1c448998fba5f5a1b00e1b9a779176ec665a6 (diff)
downloadgit-3361390cbedc962adcddcfd98676695c125fa180.zip
git-3361390cbedc962adcddcfd98676695c125fa180.tar.gz
git-3361390cbedc962adcddcfd98676695c125fa180.tar.bz2
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>
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 4a718fd..06f8dc1 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -932,8 +932,8 @@ struct tree *get_commit_tree_in_graph(struct repository *r, const struct commit
struct packed_commit_list {
struct commit **list;
- int nr;
- int alloc;
+ size_t nr;
+ size_t alloc;
};
struct write_commit_graph_context {