From a1478e586a56cab44709fce1fba1fab46f0b9c23 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 5 Jan 2017 10:46:54 +0100 Subject: [PATCH] Merge #9417: Do not evaluate hidden LogPrint arguments 407cdd6 Do not evaluate hidden LogPrint arguments (Pieter Wuille) --- src/util.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/util.h b/src/util.h index 90bf95edd..821f7ffd7 100644 --- a/src/util.h +++ b/src/util.h @@ -95,14 +95,15 @@ bool LogAcceptCategory(const char* category); /** Send a string to the log output */ int LogPrintStr(const std::string &str); -#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__) +#define LogPrint(category, ...) do { \ + if (LogAcceptCategory((category))) { \ + LogPrintStr(tfm::format(__VA_ARGS__)); \ + } \ +} while(0) -template -static inline int LogPrint(const char* category, const char* fmt, const Args&... args) -{ - if(!LogAcceptCategory(category)) return 0; \ - return LogPrintStr(tfm::format(fmt, args...)); -} +#define LogPrintf(...) do { \ + LogPrintStr(tfm::format(__VA_ARGS__)); \ +} while(0) template bool error(const char* fmt, const Args&... args)