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>
This commit is contained in:
Jeff King
2021-01-28 01:20:23 -05:00
committed by Junio C Hamano
parent 45ee13b942
commit 8380dcd700
7 changed files with 13 additions and 13 deletions

View File

@ -105,9 +105,9 @@ static timestamp_t parse_commit_date(const char *buf, const char *tail)
return parse_timestamp(dateptr, NULL, 10);
}
static const struct object_id *commit_graft_oid_access(size_t index, void *table)
static const struct object_id *commit_graft_oid_access(size_t index, const void *table)
{
struct commit_graft **commit_graft_table = table;
const struct commit_graft * const *commit_graft_table = table;
return &commit_graft_table[index]->oid;
}