Skip to content

Commit 0b868f0

Browse files
stefanbellergitster
authored andcommitted
hex.c: reduce memory footprint of sha1_to_hex static buffers
41 bytes is the exact number of bytes needed for having the returned hex string represented. 50 seems to be an arbitrary number, such that there are no benefits from alignment to certain address boundaries. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a503121 commit 0b868f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int get_sha1_hex(const char *hex, unsigned char *sha1)
5151
char *sha1_to_hex(const unsigned char *sha1)
5252
{
5353
static int bufno;
54-
static char hexbuffer[4][50];
54+
static char hexbuffer[4][41];
5555
static const char hex[] = "0123456789abcdef";
5656
char *buffer = hexbuffer[3 & ++bufno], *buf = buffer;
5757
int i;

0 commit comments

Comments
 (0)