diff options
author | John Keeping | 2013-04-06 11:23:52 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2013-04-08 16:11:29 +0200 |
commit | ed5bd30ebe6921dd22948a3f33a314283f043606 (patch) | |
tree | 494f1ac8aae7c2147146fefc9aebcdb1bfa671c0 /ui-tree.c | |
parent | d2e20e38141c882e46eaa77f172fc2ae37a19d3b (diff) | |
download | cgit-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.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -95,15 +95,13 @@ static void print_object(const unsigned char *sha1, char *path, const char *base | |||
95 | 95 | ||
96 | type = sha1_object_info(sha1, &size); | 96 | type = sha1_object_info(sha1, &size); |
97 | if (type == OBJ_BAD) { | 97 | if (type == OBJ_BAD) { |
98 | cgit_print_error(fmt("Bad object name: %s", | 98 | cgit_print_error("Bad object name: %s", sha1_to_hex(sha1)); |
99 | sha1_to_hex(sha1))); | ||
100 | return; | 99 | return; |
101 | } | 100 | } |
102 | 101 | ||
103 | buf = read_sha1_file(sha1, &type, &size); | 102 | buf = read_sha1_file(sha1, &type, &size); |
104 | if (!buf) { | 103 | if (!buf) { |
105 | cgit_print_error(fmt("Error reading object %s", | 104 | cgit_print_error("Error reading object %s", sha1_to_hex(sha1)); |
106 | sha1_to_hex(sha1))); | ||
107 | return; | 105 | return; |
108 | } | 106 | } |
109 | 107 | ||
@@ -209,8 +207,7 @@ static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_cont | |||
209 | 207 | ||
210 | tree = parse_tree_indirect(sha1); | 208 | tree = parse_tree_indirect(sha1); |
211 | if (!tree) { | 209 | if (!tree) { |
212 | cgit_print_error(fmt("Not a tree object: %s", | 210 | cgit_print_error("Not a tree object: %s", sha1_to_hex(sha1)); |
213 | sha1_to_hex(sha1))); | ||
214 | return; | 211 | return; |
215 | } | 212 | } |
216 | 213 | ||
@@ -273,12 +270,12 @@ void cgit_print_tree(const char *rev, char *path) | |||
273 | rev = ctx.qry.head; | 270 | rev = ctx.qry.head; |
274 | 271 | ||
275 | if (get_sha1(rev, sha1)) { | 272 | if (get_sha1(rev, sha1)) { |
276 | cgit_print_error(fmt("Invalid revision name: %s", rev)); | 273 | cgit_print_error("Invalid revision name: %s", rev); |
277 | return; | 274 | return; |
278 | } | 275 | } |
279 | commit = lookup_commit_reference(sha1); | 276 | commit = lookup_commit_reference(sha1); |
280 | if (!commit || parse_commit(commit)) { | 277 | if (!commit || parse_commit(commit)) { |
281 | cgit_print_error(fmt("Invalid commit reference: %s", rev)); | 278 | cgit_print_error("Invalid commit reference: %s", rev); |
282 | return; | 279 | return; |
283 | } | 280 | } |
284 | 281 | ||