sequencer: use argv_array_pushf
This avoids a manual allocation calculation, and is shorter to boot. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Jun 19, 2014 at 17:28 UTC
3bdd55228b1b76a2c37143636966f333e3782888
1 file changed
+2
-7
sequencer.c
+2
-7
@@ -396,18 +396,13 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
396
{
397
struct argv_array array;
398
int rc;
399
- char *gpg_sign;
399
400
argv_array_init(&array);
401
argv_array_push(&array, "commit");
402
argv_array_push(&array, "-n");
403
405
- if (opts->gpg_sign) {
406
- gpg_sign = xmalloc(3 + strlen(opts->gpg_sign));
407
- sprintf(gpg_sign, "-S%s", opts->gpg_sign);
408
- argv_array_push(&array, gpg_sign);
409
- free(gpg_sign);
410
- }
404
+ if (opts->gpg_sign)
405
+ argv_array_pushf(&array, "-S%s", opts->gpg_sign);
406
if (opts->signoff)
407
argv_array_push(&array, "-s");
408
if (!opts->edit) {