Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
hex: switch to using the_hash_algo
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:27:55 +0000
(
01:27
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:39 +0000
(14:27 -0700)
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>
hex.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
83e4b75
)
diff --git
a/hex.c
b/hex.c
index 8df2d63728f0405a9b1dc70aa404954dd921b6bc..10af1a29e80f903fb95cbeb71be00e5fdd705e66 100644
(file)
--- 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;
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;
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)
{
int ret = get_oid_hex(hex, oid);
if (!ret)
- *end = hex +
GIT_SHA1_HEXSZ
;
+ *end = hex +
the_hash_algo->hexsz
;
return ret;
}
return ret;
}
@@
-79,7
+79,7
@@
char *sha1_to_hex_r(char *buffer, const unsigned char *sha1)
char *buf = buffer;
int i;
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];
unsigned int val = *sha1++;
*buf++ = hex[val >> 4];
*buf++ = hex[val & 0xf];