mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
common/status: add status_tracev() for making status wrappers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
9b589fb5ba
commit
8430e33f3b
2 changed files with 13 additions and 4 deletions
|
@ -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;
|
char *str;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
str = tal_vfmt(NULL, fmt, ap);
|
str = tal_vfmt(NULL, fmt, ap);
|
||||||
status_send_with_hdr(STATUS_TRACE, str, strlen(str));
|
status_send_with_hdr(STATUS_TRACE, str, strlen(str));
|
||||||
tal_free(str);
|
tal_free(str);
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
/* Free up any temporary children. */
|
/* Free up any temporary children. */
|
||||||
if (tal_first(trc)) {
|
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, ...)
|
void status_failed(enum status_fail code, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <ccan/compiler/compiler.h>
|
#include <ccan/compiler/compiler.h>
|
||||||
#include <ccan/short_types/short_types.h>
|
#include <ccan/short_types/short_types.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
struct daemon_conn;
|
struct daemon_conn;
|
||||||
|
@ -50,6 +51,8 @@ enum status_fail {
|
||||||
void status_send_sync(const u8 *msg);
|
void status_send_sync(const u8 *msg);
|
||||||
/* Send a printf-style debugging trace. */
|
/* Send a printf-style debugging trace. */
|
||||||
void status_trace(const char *fmt, ...) PRINTF_FMT(1,2);
|
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. */
|
/* 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;
|
void status_failed(enum status_fail, const char *fmt, ...) PRINTF_FMT(2,3) NORETURN;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue