]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
add line number to debug traces 3966/head
authorYann Collet <cyan@fb.com>
Thu, 14 Mar 2024 19:11:11 +0000 (12:11 -0700)
committerYann Collet <cyan@fb.com>
Thu, 14 Mar 2024 19:11:11 +0000 (12:11 -0700)
lib/common/debug.h

index 8049e4b5d89dca3fd0dabb9f69bb713d9dc9aad8..a16b69e57439387f3061caeaa66d9c38e79f8274 100644 (file)
@@ -92,10 +92,14 @@ extern int g_debuglevel; /* the variable is only declared,
         }                                  \
     } while (0)
 
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define LINE_AS_STRING TOSTRING(__LINE__)
+
 #  define DEBUGLOG(l, ...)                               \
     do {                                                 \
         if (l<=g_debuglevel) {                           \
-            ZSTD_DEBUG_PRINT(__FILE__ ": " __VA_ARGS__); \
+            ZSTD_DEBUG_PRINT(__FILE__ ":" LINE_AS_STRING ": " __VA_ARGS__); \
             ZSTD_DEBUG_PRINT(" \n");                     \
         }                                                \
     } while (0)