path: root/hex.c
diff options
authorbrian m. carlson <>2017-03-26 16:01:24 (GMT)
committerJunio C Hamano <>2017-03-27 05:08:21 (GMT)
commitdc01505f7f272a44b974e622f75bd592debe9dcb (patch)
tree7aa62babd604067a3d928edfa988391711a36007 /hex.c
parent5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3 (diff)
Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ
Since we will likely be introducing a new hash function at some point, and that hash function might be longer than 40 hex characters, use the constant GIT_MAX_HEXSZ, which is designed to be suitable for allocations, instead of GIT_SHA1_HEXSZ. This will ease the transition down the line by distinguishing between places where we need to allocate memory suitable for the largest hash from those where we need to handle the current hash. Signed-off-by: brian m. carlson <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'hex.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/hex.c b/hex.c
index eab7b62..28b4411 100644
--- a/hex.c
+++ b/hex.c
@@ -85,7 +85,7 @@ char *oid_to_hex_r(char *buffer, const struct object_id *oid)
char *sha1_to_hex(const unsigned char *sha1)
static int bufno;
- static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
+ static char hexbuffer[4][GIT_MAX_HEXSZ + 1];
bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer);
return sha1_to_hex_r(hexbuffer[bufno], sha1);