From dc01505f7f272a44b974e622f75bd592debe9dcb Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 26 Mar 2017 16:01:24 +0000 Subject: 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 --- hex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hex.c') diff --git a/hex.c b/hex.c index eab7b626ee..28b44118cb 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); } -- cgit v1.2.3