Re: [PATCH 23/41] upload-pack: replace use of several hard-coded constants
- From
Simon Ruderich <simon@ruderich.org>
- Date
- Apr 24, 2018, 07:53 UTC
- Message-ID
- <20180424075337.GA24895@ruderich.org>
- In-Reply-To
- <20180423233951.276447-24-sandals@crustytoothpaste.net>
On Mon, Apr 23, 2018 at 11:39:33PM +0000, brian m. carlson wrote:
Show 21 quoted lines
> [snip] > > diff --git a/upload-pack.c b/upload-pack.c > index 4a82602be5..0858527c5b 100644 > --- a/upload-pack.c > +++ b/upload-pack.c > @@ -450,7 +450,7 @@ static int get_common_commits(void) > break; > default: > got_common = 1; > - memcpy(last_hex, oid_to_hex(&oid), 41); > + oid_to_hex_r(last_hex, &oid); > if (multi_ack == 2) > packet_write_fmt(1, "ACK %s common\n", last_hex); > else if (multi_ack) > @@ -492,7 +492,7 @@ static int do_reachable_revlist(struct child_process *cmd, > "rev-list", "--stdin", NULL, > }; > struct object *o; > - char namebuf[42]; /* ^ + SHA-1 + LF */ > + char namebuf[GIT_MAX_HEXSZ + 2]; /* ^ + SHA-1 + LF */
I think this comment should be "^ + hash as hex + LF".
Show 7 quoted lines
> @@ -561,15 +561,17 @@ static int get_reachable_list(struct object_array *src, > struct child_process cmd = CHILD_PROCESS_INIT; > int i; > struct object *o; > - char namebuf[42]; /* ^ + SHA-1 + LF */ > + char namebuf[GIT_MAX_HEXSZ + 2]; /* ^ + SHA-1 + LF */ > + const unsigned hexsz = the_hash_algo->hexsz;
Dito.
Regards Simon
-- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9