diff options
author | Jeff King <peff@peff.net> | 2014-06-19 23:28:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-20 00:20:55 +0200 |
commit | 3bdd55228b1b76a2c37143636966f333e3782888 (patch) | |
tree | da58ec43c2c092e6e640f771cde736316f98e970 /sequencer.c | |
parent | setup_git_env: use git_pathdup instead of xmalloc + sprintf (diff) | |
download | git-3bdd55228b1b76a2c37143636966f333e3782888.tar.xz git-3bdd55228b1b76a2c37143636966f333e3782888.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | sequencer.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c index 0a80c58d11..2fea824349 100644 --- a/sequencer.c +++ b/sequencer.c @@ -396,18 +396,13 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, { struct argv_array array; int rc; - char *gpg_sign; argv_array_init(&array); argv_array_push(&array, "commit"); argv_array_push(&array, "-n"); - if (opts->gpg_sign) { - gpg_sign = xmalloc(3 + strlen(opts->gpg_sign)); - sprintf(gpg_sign, "-S%s", opts->gpg_sign); - argv_array_push(&array, gpg_sign); - free(gpg_sign); - } + if (opts->gpg_sign) + argv_array_pushf(&array, "-S%s", opts->gpg_sign); if (opts->signoff) argv_array_push(&array, "-s"); if (!opts->edit) { |