html.c: add various strbuf and varadic helpers

This adds the fmtalloc helper, html_txtf, html_vtxtf, and html_attrf.

These takes a printf style format string like htmlf but escapes the
resulting string.  The html_vtxtf variant takes a va_list whereas
html_txtf is variadic.

Signed-off-by: John Keeping <john@keeping.me.uk>
This commit is contained in:
John Keeping 2013-04-07 14:40:50 +01:00 committed by Jason A. Donenfeld
parent 57d09bf448
commit fd00d2f9d6
3 changed files with 63 additions and 4 deletions

3
cgit.h
View file

@ -327,6 +327,9 @@ extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
__attribute__((format (printf,1,2)))
extern char *fmt(const char *format,...);
__attribute__((format (printf,1,2)))
extern char *fmtalloc(const char *format,...);
extern struct commitinfo *cgit_parse_commit(struct commit *commit);
extern struct taginfo *cgit_parse_tag(struct tag *tag);
extern void cgit_parse_url(const char *url);