Code

Merge branch 'ph/strbuf'
[git.git] / builtin-rev-list.c
index 38946339999e4e136b898b8f314e27d22ec1decb..414b2f32b293c9d6d7ca2a821f903de64ea8ea21 100644 (file)
@@ -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) {