From 8e6bd45485c358e5081e5f49e8376e8098f4a95e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 6 Oct 2015 16:51:35 +0100 Subject: [PATCH] Add %T for printing rspamd_ftok_t --- src/libutil/printf.c | 8 +++++++- src/libutil/printf.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libutil/printf.c b/src/libutil/printf.c index 7fe7a9c26..9204060b2 100644 --- a/src/libutil/printf.c +++ b/src/libutil/printf.c @@ -338,6 +338,7 @@ rspamd_vprintf_common (rspamd_printf_append_func func, guint64 ui64; guint width, sign, hex, humanize, bytes, frac_width, i; rspamd_fstring_t *v; + rspamd_ftok_t *tok; GString *gs; GError *err; gboolean bv; @@ -457,6 +458,11 @@ rspamd_vprintf_common (rspamd_printf_append_func func, continue; + case 'T': + tok = va_arg (args, rspamd_ftok_t *); + RSPAMD_PRINTF_APPEND (tok->begin, tok->len); + continue; + case 'v': gs = va_arg (args, GString *); RSPAMD_PRINTF_APPEND (gs->str, gs->len); @@ -523,7 +529,7 @@ rspamd_vprintf_common (rspamd_printf_append_func func, sign = 1; break; - case 'T': + case 't': i64 = (gint64) va_arg (args, time_t); sign = 1; break; diff --git a/src/libutil/printf.h b/src/libutil/printf.h index d0db483d9..8cd699212 100644 --- a/src/libutil/printf.h +++ b/src/libutil/printf.h @@ -44,7 +44,8 @@ * %P pid_t * %r rlim_t * %p void * - * %V f_str_t * + * %V rspamd_fstring_t * + * %T rspamd_ftok_t * %v GString * * %s null-terminated string * %xs hex encoded string @@ -52,6 +53,7 @@ * %Z '\0' * %N '\n' * %c gchar + * %t time_t * %e GError * * %% % * -- 2.39.5