From: Pavel Filipenský Date: Sun, 19 Jun 2022 13:40:37 +0000 (+0200) Subject: debug: Add DEBUGLF macro with explicit location and function parameters. X-Git-Tag: tevent-0.13.0~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0e0a95320019ce2b2eac6350d95ec1fb3b2d563;p=thirdparty%2Fsamba.git debug: Add DEBUGLF macro with explicit location and function parameters. Signed-off-by: Pavel Filipenský Reviewed-by: Andreas Schneider --- diff --git a/lib/util/debug.h b/lib/util/debug.h index 40cae58e790..f58bb005145 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -199,6 +199,25 @@ void debuglevel_set_class(size_t idx, int level); && (dbghdrclass( level, DBGC_CLASS, __location__, __FUNCTION__ )) \ && (dbgtext body) ) +/** + * @brief DEBUGLF is same as DEBUG with explicit location and function arguments + * + * To be used when passing location and function of a caller appearig earlier in + * the call stack instead of some helper function. + * + * @code + * DEBUGLF( 2, ("Some text.\n"), "foo.c:1", "foo" ); + * DEBUGLF( 5, ("Some text.\n"), location, function ); + * @endcode + * + * @return void. + */ +#define DEBUGLF( level, body, location, function ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely(debuglevel_get_class(DBGC_CLASS) >= (level)) \ + && (dbghdrclass( level, DBGC_CLASS, location, function )) \ + && (dbgtext body) ) + #define DEBUGC( dbgc_class, level, body ) \ (void)( ((level) <= MAX_DEBUG_LEVEL) && \ unlikely(debuglevel_get_class(dbgc_class) >= (level)) \