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 /hash-lookup.c | |
parent | 45ee13b942b26925b33d827bda2856e1ed0af0b7 (diff) | |
download | git-8380dcd700e80cd22745bcffb3625f90f943950c.tar.gz |
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 'hash-lookup.c')
-rw-r--r-- | hash-lookup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hash-lookup.c b/hash-lookup.c index d15bb34574..b98ed5e11e 100644 --- a/hash-lookup.c +++ b/hash-lookup.c @@ -50,7 +50,7 @@ static uint32_t take2(const struct object_id *oid, size_t ofs) * The oid of element i (between 0 and nr - 1) should be returned * by "fn(i, table)". */ -int oid_pos(const struct object_id *oid, void *table, size_t nr, +int oid_pos(const struct object_id *oid, const void *table, size_t nr, oid_access_fn fn) { size_t hi = nr; |