diff options
author | Jeff King <peff@peff.net> | 2021-01-28 01:19:42 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-28 12:02:39 -0800 |
commit | 45ee13b942b26925b33d827bda2856e1ed0af0b7 (patch) | |
tree | 87f89914fdf93c8d3ef42411657c668680ccadcf /hash-lookup.h | |
parent | 680ff910b0329c8482f98ad9d3c49f4628c1bafa (diff) | |
download | git-45ee13b942b26925b33d827bda2856e1ed0af0b7.tar.gz |
hash_pos(): convert to oid_pos()
All of our callers are actually looking up an object_id, not a bare
hash. Likewise, the arrays they are looking in are actual arrays of
object_id (not just raw bytes of hashes, as we might find in a pack
.idx; those are handled by bsearch_hash()).
Using an object_id gives us more type safety, and makes the callers
slightly shorter. It also gets rid of the word "sha1" from several
access functions, though we could obviously also rename those with
s/sha1/hash/.
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.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hash-lookup.h b/hash-lookup.h index 5d476dec72..7b3ecad1f0 100644 --- a/hash-lookup.h +++ b/hash-lookup.h @@ -1,12 +1,12 @@ #ifndef HASH_LOOKUP_H #define HASH_LOOKUP_H -typedef const unsigned char *hash_access_fn(size_t index, void *table); +typedef const struct object_id *oid_access_fn(size_t index, void *table); -int hash_pos(const unsigned char *hash, - void *table, - size_t nr, - hash_access_fn fn); +int oid_pos(const struct object_id *oid, + void *table, + size_t nr, + oid_access_fn fn); /* * Searches for hash in table, using the given fanout table to determine the |