diff options
author | Jeff King <peff@peff.net> | 2021-01-28 01:20:23 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-28 12:03:26 -0800 |
commit | 8380dcd700e80cd22745bcffb3625f90f943950c (patch) | |
tree | a4ab3fcfe1f8b98af53592eaedd64f7b07eb4dff /commit-graph.c | |
parent | hash_pos(): convert to oid_pos() (diff) | |
download | tgif-8380dcd700e80cd22745bcffb3625f90f943950c.tar.xz |
oid_pos(): access table through const pointers
When we are looking up an oid in an array, we obviously don't need to
write to the array. Let's mark it as const in the function interfaces,
as well as in the local variables we use to derference the void pointer
(note a few cases use pointers-to-pointers, so we mark everything
const).
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/commit-graph.c b/commit-graph.c index 248f1efb73..b09fce5f57 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1012,9 +1012,9 @@ static int write_graph_chunk_oids(struct hashfile *f, return 0; } -static const struct object_id *commit_to_oid(size_t index, void *table) +static const struct object_id *commit_to_oid(size_t index, const void *table) { - struct commit **commits = table; + const struct commit * const *commits = table; return &commits[index]->object.oid; } |