From 8430e33f3b101a3a931a547300e04ee5546209a9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 11 Oct 2017 20:32:50 +1030 Subject: [PATCH] common/status: add status_tracev() for making status wrappers. Signed-off-by: Rusty Russell --- common/status.c | 14 ++++++++++---- common/status.h | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/status.c b/common/status.c index eeacf68ff..c55285375 100644 --- a/common/status.c +++ b/common/status.c @@ -75,16 +75,13 @@ static void status_send_with_hdr(u16 type, const void *p, size_t len) } } -void status_trace(const char *fmt, ...) +void status_tracev(const char *fmt, va_list ap) { - va_list ap; char *str; - va_start(ap, fmt); str = tal_vfmt(NULL, fmt, ap); status_send_with_hdr(STATUS_TRACE, str, strlen(str)); tal_free(str); - va_end(ap); /* Free up any temporary children. */ if (tal_first(trc)) { @@ -93,6 +90,15 @@ void status_trace(const char *fmt, ...) } } +void status_trace(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + status_tracev(fmt, ap); + va_end(ap); +} + void status_failed(enum status_fail code, const char *fmt, ...) { va_list ap; diff --git a/common/status.h b/common/status.h index 65f631c14..7e01c0ae6 100644 --- a/common/status.h +++ b/common/status.h @@ -3,6 +3,7 @@ #include "config.h" #include #include +#include #include struct daemon_conn; @@ -50,6 +51,8 @@ enum status_fail { void status_send_sync(const u8 *msg); /* Send a printf-style debugging trace. */ void status_trace(const char *fmt, ...) PRINTF_FMT(1,2); +/* vprintf-style */ +void status_tracev(const char *fmt, va_list ap); /* Send a failure status code with printf-style msg, and exit. */ void status_failed(enum status_fail, const char *fmt, ...) PRINTF_FMT(2,3) NORETURN;