summaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-07-16 01:27:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 21:27:39 (GMT)
commitd9cd734990a5fedbf7fc34debe6c10d5d10e954a (patch)
tree97e460ec32a3095467df2c5e7bca985721b8bc6c /hex.c
parent83e4b7571c7d78e8236ad87519b75a90e7902a34 (diff)
downloadgit-d9cd734990a5fedbf7fc34debe6c10d5d10e954a.zip
git-d9cd734990a5fedbf7fc34debe6c10d5d10e954a.tar.gz
git-d9cd734990a5fedbf7fc34debe6c10d5d10e954a.tar.bz2
hex: switch to using the_hash_algo
Instead of using the GIT_SHA1_* constants, switch to using the_hash_algo to convert object IDs to and from hex format. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hex.c b/hex.c
index 8df2d63..10af1a2 100644
--- a/hex.c
+++ b/hex.c
@@ -50,7 +50,7 @@ int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)
int get_sha1_hex(const char *hex, unsigned char *sha1)
{
int i;
- for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
+ for (i = 0; i < the_hash_algo->rawsz; i++) {
int val = hex2chr(hex);
if (val < 0)
return -1;
@@ -69,7 +69,7 @@ int parse_oid_hex(const char *hex, struct object_id *oid, const char **end)
{
int ret = get_oid_hex(hex, oid);
if (!ret)
- *end = hex + GIT_SHA1_HEXSZ;
+ *end = hex + the_hash_algo->hexsz;
return ret;
}
@@ -79,7 +79,7 @@ char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
char *buf = buffer;
int i;
- for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
+ for (i = 0; i < the_hash_algo->rawsz; i++) {
unsigned int val = *sha1++;
*buf++ = hex[val >> 4];
*buf++ = hex[val & 0xf];