Skip to content

Commit d9cd734

Browse files
bk2204gitster
authored andcommitted
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>
1 parent 83e4b75 commit d9cd734

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int hex_to_bytes(unsigned char *binary, const char *hex, size_t len)
5050
int get_sha1_hex(const char *hex, unsigned char *sha1)
5151
{
5252
int i;
53-
for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
53+
for (i = 0; i < the_hash_algo->rawsz; i++) {
5454
int val = hex2chr(hex);
5555
if (val < 0)
5656
return -1;
@@ -69,7 +69,7 @@ int parse_oid_hex(const char *hex, struct object_id *oid, const char **end)
6969
{
7070
int ret = get_oid_hex(hex, oid);
7171
if (!ret)
72-
*end = hex + GIT_SHA1_HEXSZ;
72+
*end = hex + the_hash_algo->hexsz;
7373
return ret;
7474
}
7575

@@ -79,7 +79,7 @@ char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
7979
char *buf = buffer;
8080
int i;
8181

82-
for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
82+
for (i = 0; i < the_hash_algo->rawsz; i++) {
8383
unsigned int val = *sha1++;
8484
*buf++ = hex[val >> 4];
8585
*buf++ = hex[val & 0xf];

0 commit comments

Comments
 (0)