From 4b36d5e8de50f729f5bfe10667c1f9138f756c11 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 24 Jan 2023 18:03:07 +0100 Subject: [PATCH] MINOR: trace: add a trace_no_cb() dummy callback for when to use no callback By default, passing a NULL cb to the trace functions will result in the source's default one to be used. For some cases we won't want to use any callback at all, not event the default one. Let's define a trace_no_cb() function for this, that does absolutely nothing. --- include/haproxy/trace.h | 4 ++++ src/trace.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/haproxy/trace.h b/include/haproxy/trace.h index 2c823e4..2ddc8d5 100644 --- a/include/haproxy/trace.h +++ b/include/haproxy/trace.h @@ -149,6 +149,10 @@ void __trace(enum trace_level level, uint64_t mask, struct trace_source *src, const void *a1, const void *a2, const void *a3, const void *a4), const struct ist msg); +void trace_no_cb(enum trace_level level, uint64_t mask, const struct trace_source *src, + const struct ist where, const struct ist func, + const void *a1, const void *a2, const void *a3, const void *a4); + void trace_register_source(struct trace_source *source); /* return a single char to describe a trace state */ diff --git a/src/trace.c b/src/trace.c index 6aa155d..32fac61 100644 --- a/src/trace.c +++ b/src/trace.c @@ -298,6 +298,14 @@ void __trace(enum trace_level level, uint64_t mask, struct trace_source *src, } } +/* this callback may be used when no output modification is desired */ +void trace_no_cb(enum trace_level level, uint64_t mask, const struct trace_source *src, + const struct ist where, const struct ist func, + const void *a1, const void *a2, const void *a3, const void *a4) +{ + /* do nothing */ +} + /* registers trace source . Modifies the list element! * The {start,pause,stop,report} events are not changed so the source may * preset them. -- 1.7.10.4