Diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/ui-shared.c | 16 | |
| -rw-r--r-- | source/ui-shared.h | 1 |
2 files changed, 4 insertions, 13 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c index de23353..a793be1 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -718,12 +718,8 @@ static const char *find_last_char(const char *start, const char *end, int c) static void vprint_error(const char *fmt, va_list ap) { - va_list cp; - html("<div class='error'>"); - va_copy(cp, ap); - html_vtxtf(fmt, cp); - va_end(cp); + html_vtxtf(fmt, ap); html("</div>\n"); } @@ -1537,23 +1533,18 @@ void cgit_print_error_page(int code, const char *msg, const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - cgit_vprint_error_page(code, msg, fmt, ap); - va_end(ap); -} - -void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list ap) -{ // An error page describes a condition that may not outlast the slot // holding it. A request naming a commit not yet pushed would cache its // 404 under the never-expiring static ttl and keep serving it after // the push, so the error is rendered straight to the visitor instead. html_flush(); cache_abandon_fill(); + va_start(ap, fmt); // Once the status line is out the error can only join the body under // way, and the page that hit it carries on to its own end. if (ctx.page.headers_sent) { vprint_error(fmt, ap); + va_end(ap); return; } ctx.page.status = code; @@ -1565,6 +1556,7 @@ void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list ctx.page.filename = NULL; cgit_print_layout_start(); vprint_error(fmt, ap); + va_end(ap); cgit_print_layout_end(); } diff --git a/source/ui-shared.h b/source/ui-shared.h index 59751ae..7473ef3 100644 --- a/source/ui-shared.h +++ b/source/ui-shared.h @@ -110,7 +110,6 @@ extern void cgit_print_docstart(void); extern void cgit_print_docend(void); __attribute__((format (printf,3,4))) extern void cgit_print_error_page(int code, const char *msg, const char *fmt, ...); -extern void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list ap); /* * Answer with the error page for a blob of size bytes past max-blob-size. |
