From 8380dcd700e80cd22745bcffb3625f90f943950c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 28 Jan 2021 01:20:23 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- pack-bitmap-write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pack-bitmap-write.c') diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index f21259dfc8..88d9e696a5 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -610,9 +610,9 @@ static inline void dump_bitmap(struct hashfile *f, struct ewah_bitmap *bitmap) die("Failed to write bitmap index"); } -static const struct object_id *oid_access(size_t pos, void *table) +static const struct object_id *oid_access(size_t pos, const void *table) { - struct pack_idx_entry **index = table; + const struct pack_idx_entry * const *index = table; return &index[pos]->oid; } -- cgit v1.2.1