mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
hash: require hash algorithm in oidread() and oidclr()
Both `oidread()` and `oidclr()` use `the_repository` to derive the hash function that shall be used. Require callers to pass in the hash algorithm to get rid of this implicit dependency. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
f4836570a7
commit
9da95bda74
17
hash.h
17
hash.h
@@ -47,23 +47,6 @@ static inline void oidcpy_with_padding(struct object_id *dst,
|
||||
dst->algo = src->algo;
|
||||
}
|
||||
|
||||
static inline void oidclr(struct object_id *oid)
|
||||
{
|
||||
memset(oid->hash, 0, GIT_MAX_RAWSZ);
|
||||
oid->algo = hash_algo_by_ptr(the_hash_algo);
|
||||
}
|
||||
|
||||
static inline void oidread_algop(struct object_id *oid, const unsigned char *hash, const struct git_hash_algo *algop)
|
||||
{
|
||||
memcpy(oid->hash, hash, algop->rawsz);
|
||||
oid->algo = hash_algo_by_ptr(algop);
|
||||
}
|
||||
|
||||
static inline void oidread(struct object_id *oid, const unsigned char *hash)
|
||||
{
|
||||
oidread_algop(oid, hash, the_hash_algo);
|
||||
}
|
||||
|
||||
static inline int is_empty_blob_oid(const struct object_id *oid)
|
||||
{
|
||||
return oideq(oid, the_hash_algo->empty_blob);
|
||||
|
||||
Reference in New Issue
Block a user