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
@ -1,10 +1,10 @@
|
||||
#ifndef HASH_LOOKUP_H
|
||||
#define HASH_LOOKUP_H
|
||||
|
||||
typedef const struct object_id *oid_access_fn(size_t index, void *table);
|
||||
typedef const struct object_id *oid_access_fn(size_t index, const void *table);
|
||||
|
||||
int oid_pos(const struct object_id *oid,
|
||||
void *table,
|
||||
const void *table,
|
||||
size_t nr,
|
||||
oid_access_fn fn);
|
||||
|
||||
|
Reference in New Issue
Block a user