Re: [PATCH 52/67] use sha1_to_hex_to() instead of strcpy
- From
Jeff King <peff@peff.net>
- Date
- Sep 16, 2015, 21:54 UTC
- Message-ID
- <20150916215429.GA23667@sigill.intra.peff.net>
- In-Reply-To
- <xmqq1tdyowxa.fsf@gitster.mtv.corp.google.com>
On Wed, Sep 16, 2015 at 02:51:13PM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes:
>
> > diff --git a/builtin/merge-index.c b/builtin/merge-index.c
> > index 1d66111..4ed0a83 100644
> > --- a/builtin/merge-index.c
> > +++ b/builtin/merge-index.c
> > @@ -9,7 +9,7 @@ static int merge_entry(int pos, const char *path)
> > {
> > int found;
> > const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL };
> > - char hexbuf[4][60];
> > + char hexbuf[4][GIT_SHA1_HEXSZ + 1];
> > char ownbuf[4][60];
>
> So you saved 19*4 = 76 bytes at runtime?
>
> Looks good ;-).I think we can save even more in ownbuf, which holds only octal modes. That was out of scope for this patch, though. :)
-Peff