]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
debug: Add DEBUGLF macro with explicit location and function parameters.
authorPavel Filipenský <pfilipen@redhat.com>
Sun, 19 Jun 2022 13:40:37 +0000 (15:40 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 15 Jul 2022 14:25:37 +0000 (14:25 +0000)
Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/util/debug.h

index 40cae58e790e984022c23fa68cfcf66d2ef37d4e..f58bb005145a1a7eb230b765d47c6fb5d266c42b 100644 (file)
@@ -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))             \