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>

brian m. carlson committed Jul 16, 2018 at 01:27 UTC d9cd734990a5fedbf7fc34debe6c10d5d10e954a
1 file changed +3 -3
hex.c
+3 -3
@@ -50,7 +50,7 @@ int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)
50 int get_sha1_hex(const char *hex, unsigned char *sha1)
51 {
52 int i;
53 - for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
53 + for (i = 0; i < the_hash_algo->rawsz; i++) {
54 int val = hex2chr(hex);
55 if (val < 0)
56 return -1;
@@ -69,7 +69,7 @@ int parse_oid_hex(const char *hex, struct object_id *oid, const char **end)
69 {
70 int ret = get_oid_hex(hex, oid);
71 if (!ret)
72 - *end = hex + GIT_SHA1_HEXSZ;
72 + *end = hex + the_hash_algo->hexsz;
73 return ret;
74 }
75
@@ -79,7 +79,7 @@ char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
79 char *buf = buffer;
80 int i;
81
82 - for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
82 + for (i = 0; i < the_hash_algo->rawsz; i++) {
83 unsigned int val = *sha1++;
84 *buf++ = hex[val >> 4];
85 *buf++ = hex[val & 0xf];