receive-pack: simplify keep_arg computation
authorJeff King <peff@peff.net>
Thu, 24 Sep 2015 21:08:14 +0000 (17:08 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Oct 2015 18:08:05 +0000 (11:08 -0700)
commitb26cb7c777f8fcca5ec26cc6a7f9eba85378104f
tree383f961c9a425f0adc42ea5317484172664821e3
parentc7ab0ba3405dc6bc8ade1296ef070a5a89660e76
receive-pack: simplify keep_arg computation

To generate "--keep=receive-pack $pid on $host", we write
progressively into a single buffer, which requires keeping
track of how much we've written so far. But since the result
is destined to go into our argv array, we can simply use
argv_array_pushf.

Unfortunately we still have to have a fixed-size buffer for
the gethostname() call, but at least it now doesn't involve
any extra size computation. And as a bonus, we drop an
sprintf and a strcpy call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c