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-shared.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-shared.c')
-rw-r--r-- | ui-shared.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c index c1f3c20..b93b77a 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -28,10 +28,21 @@ static char *http_date(time_t t) | |||
28 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 28 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
29 | } | 29 | } |
30 | 30 | ||
31 | void cgit_print_error(const char *msg) | 31 | void cgit_print_error(const char *fmt, ...) |
32 | { | 32 | { |
33 | va_list ap; | ||
34 | va_start(ap, fmt); | ||
35 | cgit_vprint_error(fmt, ap); | ||
36 | va_end(ap); | ||
37 | } | ||
38 | |||
39 | void cgit_vprint_error(const char *fmt, va_list ap) | ||
40 | { | ||
41 | va_list cp; | ||
33 | html("<div class='error'>"); | 42 | html("<div class='error'>"); |
34 | html_txt(msg); | 43 | va_copy(cp, ap); |
44 | html_vtxtf(fmt, cp); | ||
45 | va_end(cp); | ||
35 | html("</div>\n"); | 46 | html("</div>\n"); |
36 | } | 47 | } |
37 | 48 | ||