aboutsummaryrefslogtreecommitdiff
path: root/ui-tree.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-04-06 11:23:52 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2013-04-08 16:11:29 +0200
commited5bd30ebe6921dd22948a3f33a314283f043606 (patch)
tree494f1ac8aae7c2147146fefc9aebcdb1bfa671c0 /ui-tree.c
parentd2e20e38141c882e46eaa77f172fc2ae37a19d3b (diff)
downloadcgit-ed5bd30ebe6921dd22948a3f33a314283f043606.tar.gz
cgit-ed5bd30ebe6921dd22948a3f33a314283f043606.tar.bz2
cgit-ed5bd30ebe6921dd22948a3f33a314283f043606.zip
Convert cgit_print_error to a variadic function
This removes many uses of "fmt" which uses a fixed size static pool of fixed size buffers. Instead of relying on these, we now pass around argument lists for as long as possible before using a strbuf to render content of an arbitrary size. Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ui-tree.c b/ui-tree.c
index d713553..aebe145 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -95,15 +95,13 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
type = sha1_object_info(sha1, &size);
if (type == OBJ_BAD) {
- cgit_print_error(fmt("Bad object name: %s",
- sha1_to_hex(sha1)));
+ cgit_print_error("Bad object name: %s", sha1_to_hex(sha1));
return;
}
buf = read_sha1_file(sha1, &type, &size);
if (!buf) {
- cgit_print_error(fmt("Error reading object %s",
- sha1_to_hex(sha1)));
+ cgit_print_error("Error reading object %s", sha1_to_hex(sha1));
return;
}
@@ -209,8 +207,7 @@ static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_cont
tree = parse_tree_indirect(sha1);
if (!tree) {
- cgit_print_error(fmt("Not a tree object: %s",
- sha1_to_hex(sha1)));
+ cgit_print_error("Not a tree object: %s", sha1_to_hex(sha1));
return;
}
@@ -273,12 +270,12 @@ void cgit_print_tree(const char *rev, char *path)
rev = ctx.qry.head;
if (get_sha1(rev, sha1)) {
- cgit_print_error(fmt("Invalid revision name: %s", rev));
+ cgit_print_error("Invalid revision name: %s", rev);
return;
}
commit = lookup_commit_reference(sha1);
if (!commit || parse_commit(commit)) {
- cgit_print_error(fmt("Invalid commit reference: %s", rev));
+ cgit_print_error("Invalid commit reference: %s", rev);
return;
}