mirror of
https://git.zx2c4.com/cgit
synced 2025-07-02 22:34:32 +02:00
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>
This commit is contained in:
parent
d2e20e3814
commit
ed5bd30ebe
11 changed files with 57 additions and 45 deletions
15
ui-shared.c
15
ui-shared.c
|
@ -28,10 +28,21 @@ static char *http_date(time_t t)
|
|||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
}
|
||||
|
||||
void cgit_print_error(const char *msg)
|
||||
void cgit_print_error(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
cgit_vprint_error(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void cgit_vprint_error(const char *fmt, va_list ap)
|
||||
{
|
||||
va_list cp;
|
||||
html("<div class='error'>");
|
||||
html_txt(msg);
|
||||
va_copy(cp, ap);
|
||||
html_vtxtf(fmt, cp);
|
||||
va_end(cp);
|
||||
html("</div>\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue