summaryrefslogtreecommitdiff
path: root/builtin-rev-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-10-03 10:06:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-10-03 10:06:02 (GMT)
commit66d4035e1099477aa488c24c0c081ee764f85868 (patch)
treed89d0c1d61e5af45c19c0903d75aed970ffa2220 /builtin-rev-list.c
parente66273a6abb8e9cd0967d52113e29c8014a255f8 (diff)
parent9a76adebd6dfe144c3643e7e877fff2b41be5c8e (diff)
downloadgit-66d4035e1099477aa488c24c0c081ee764f85868.zip
git-66d4035e1099477aa488c24c0c081ee764f85868.tar.gz
git-66d4035e1099477aa488c24c0c081ee764f85868.tar.bz2
Merge branch 'ph/strbuf'
* ph/strbuf: (44 commits) Make read_patch_file work on a strbuf. strbuf_read_file enhancement, and use it. strbuf change: be sure ->buf is never ever NULL. double free in builtin-update-index.c Clean up stripspace a bit, use strbuf even more. Add strbuf_read_file(). rerere: Fix use of an empty strbuf.buf Small cache_tree_write refactor. Make builtin-rerere use of strbuf nicer and more efficient. Add strbuf_cmp. strbuf_setlen(): do not barf on setting length of an empty buffer to 0 sq_quote_argv and add_to_string rework with strbuf's. Full rework of quote_c_style and write_name_quoted. Rework unquote_c_style to work on a strbuf. strbuf API additions and enhancements. nfv?asprintf are broken without va_copy, workaround them. Fix the expansion pattern of the pseudo-static path buffer. builtin-for-each-ref.c::copy_name() - do not overstep the buffer. builtin-apply.c: fix a tiny leak introduced during xmemdupz() conversion. Use xmemdupz() in many places. ...
Diffstat (limited to 'builtin-rev-list.c')
-rw-r--r--builtin-rev-list.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 3894633..414b2f3 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -80,13 +80,12 @@ 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);
- 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);
+ printf("%s%c", buf.buf, hdr_termination);
+ strbuf_release(&buf);
}
maybe_flush_or_die(stdout, "stdout");
if (commit->parents) {