From: Willy Tarreau Date: Tue, 24 Jan 2023 17:03:07 +0000 (+0100) Subject: MINOR: trace: add a trace_no_cb() dummy callback for when to use no callback X-Git-Tag: v2.8-dev3~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b36d5e8de50f729f5bfe10667c1f9138f756c11;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/trace.h b/include/haproxy/trace.h index 2c823e460d..2ddc8d5876 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 6aa155d44e..32fac61d39 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.