summaryrefslogtreecommitdiff
path: root/hash-lookup.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-01-28 01:20:23 -0500
committerJunio C Hamano <gitster@pobox.com>2021-01-28 12:03:26 -0800
commit8380dcd700e80cd22745bcffb3625f90f943950c (patch)
treea4ab3fcfe1f8b98af53592eaedd64f7b07eb4dff /hash-lookup.h
parent45ee13b942b26925b33d827bda2856e1ed0af0b7 (diff)
downloadgit-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.h')
-rw-r--r--hash-lookup.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/hash-lookup.h b/hash-lookup.h
index 7b3ecad1f0..dbd71ebaf7 100644
--- a/hash-lookup.h
+++ b/hash-lookup.h
@@ -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);