summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-07-16 01:27:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 21:27:38 (GMT)
commit509f6f62a4b0dfd1c06dc2120ad06b9d50a1b64a (patch)
treedba66de4dbd8b10a203e29550cbf525c9d67a59a /cache.h
parente3331758f12da22f4103eec7efe1b5304a9be5e9 (diff)
downloadgit-509f6f62a4b0dfd1c06dc2120ad06b9d50a1b64a.zip
git-509f6f62a4b0dfd1c06dc2120ad06b9d50a1b64a.tar.gz
git-509f6f62a4b0dfd1c06dc2120ad06b9d50a1b64a.tar.bz2
cache: update object ID functions for the_hash_algo
Most of our code has been converted to use struct object_id for object IDs. However, there are some places that still have not, and there are a variety of places that compare equivalently sized hashes that are not object IDs. All of these hashes are artifacts of the internal hash algorithm in use, and when we switch to NewHash for object storage, all of these uses will also switch. Update the hashcpy, hashclr, and hashcmp functions to use the_hash_algo, since they are used in a variety of places to copy and manipulate buffers that need to move data into or out of struct object_id. This has the effect of making the corresponding oid* functions use the_hash_algo as well. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/cache.h b/cache.h
index d49092d..f00cc81 100644
--- a/cache.h
+++ b/cache.h
@@ -972,7 +972,7 @@ extern const struct object_id null_oid;
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
- return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
+ return memcmp(sha1, sha2, the_hash_algo->rawsz);
}
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
@@ -992,7 +992,7 @@ static inline int is_null_oid(const struct object_id *oid)
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
{
- memcpy(sha_dst, sha_src, GIT_SHA1_RAWSZ);
+ memcpy(sha_dst, sha_src, the_hash_algo->rawsz);
}
static inline void oidcpy(struct object_id *dst, const struct object_id *src)
@@ -1009,7 +1009,7 @@ static inline struct object_id *oiddup(const struct object_id *src)
static inline void hashclr(unsigned char *hash)
{
- memset(hash, 0, GIT_SHA1_RAWSZ);
+ memset(hash, 0, the_hash_algo->rawsz);
}
static inline void oidclr(struct object_id *oid)