diff options
Diffstat (limited to 'builtin-rev-list.c')
-rw-r--r-- | builtin-rev-list.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c index 0b74eb35bc..33726b8d84 100644 --- a/builtin-rev-list.c +++ b/builtin-rev-list.c @@ -80,14 +80,13 @@ static void show_commit(struct commit *commit) putchar('\n'); if (revs.verbose_header) { - char *buf = NULL; - unsigned long buflen = 0; - pretty_print_commit(revs.commit_format, commit, ~0, - &buf, &buflen, - revs.abbrev, NULL, NULL, revs.date_mode); - if (*buf) - printf("%s%c", buf, hdr_termination); - free(buf); + struct strbuf buf; + strbuf_init(&buf, 0); + pretty_print_commit(revs.commit_format, commit, + &buf, revs.abbrev, NULL, NULL, revs.date_mode); + if (buf.len) + printf("%s%c", buf.buf, hdr_termination); + strbuf_release(&buf); } maybe_flush_or_die(stdout, "stdout"); if (commit->parents) { |