From: Yann Collet Date: Thu, 14 Mar 2024 19:11:11 +0000 (-0700) Subject: add line number to debug traces X-Git-Tag: v1.5.6^2~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3966%2Fhead;p=thirdparty%2Fzstd.git add line number to debug traces --- diff --git a/lib/common/debug.h b/lib/common/debug.h index 8049e4b5d..a16b69e57 100644 --- a/lib/common/debug.h +++ b/lib/common/debug.h @@ -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)