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:

committed by
Junio C Hamano

parent
45ee13b942
commit
8380dcd700
@ -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;
|
||||
|
Reference in New Issue
Block a user