summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorPierre Habouzit <madcoder@debian.org>2007-09-10 10:35:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-10 19:49:50 (GMT)
commit674d1727305211f7ade4ade70440220f74f55162 (patch)
tree9b47dc4f9045516f181e3fc134b34d6ea1f45d5c /commit.h
parent4acfd1b799acf43642a28a22cc794266c25129ef (diff)
downloadgit-674d1727305211f7ade4ade70440220f74f55162.zip
git-674d1727305211f7ade4ade70440220f74f55162.tar.gz
git-674d1727305211f7ade4ade70440220f74f55162.tar.bz2
Rework pretty_print_commit to use strbufs instead of custom buffers.
Also remove the "len" parameter, as: (1) it was used as a max boundary, and every caller used ~0u (2) we check for final NUL no matter what, so it doesn't help for speed. As a result most of the pp_* function takes 3 arguments less, and we need a lot less local variables, this makes the code way more readable, and easier to extend if needed. This patch also fixes some spacing and cosmetic issues. This patch also fixes (as a side effect) a memory leak intoruced in builtin-archive.c at commit df4a394f (fmt was xmalloc'ed and not free'd) Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/commit.h b/commit.h
index a8d7661..b779de8 100644
--- a/commit.h
+++ b/commit.h
@@ -3,6 +3,7 @@
#include "object.h"
#include "tree.h"
+#include "strbuf.h"
#include "decorate.h"
struct commit_list {
@@ -61,8 +62,12 @@ enum cmit_fmt {
};
extern enum cmit_fmt get_commit_format(const char *arg);
-extern long format_commit_message(const struct commit *commit, const void *template, char **buf_p, unsigned long *space_p);
-extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char **buf_p, unsigned long *space_p, int abbrev, const char *subject, const char *after_subject, enum date_mode dmode);
+extern void format_commit_message(const struct commit *commit,
+ const void *format, struct strbuf *sb);
+extern void pretty_print_commit(enum cmit_fmt fmt, const struct commit*,
+ struct strbuf *,
+ int abbrev, const char *subject,
+ const char *after_subject, enum date_mode);
/** Removes the first commit from a list sorted by date, and adds all
* of its parents.