aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-12-23 14:22:46 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2016-12-23 14:22:46 -0800
commit407cdd6cb8db7baacf3c4d7bf9bae5fe38d7f098 (patch)
treee47b78cd0b2c012435921b700d13f965214e99dd /src/util.h
parente8cfe1ee2d01c493b758a67ad14707dca15792ea (diff)
downloadbitcoin-407cdd6cb8db7baacf3c4d7bf9bae5fe38d7f098.tar.xz
Do not evaluate hidden LogPrint arguments
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/util.h b/src/util.h
index 3ec38a7c7d..c9ead65a8b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -74,14 +74,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__)
-
-template<typename... Args>
-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 LogPrint(category, ...) do { \
+ if (LogAcceptCategory((category))) { \
+ LogPrintStr(tfm::format(__VA_ARGS__)); \
+ } \
+} while(0)
+
+#define LogPrintf(...) do { \
+ LogPrintStr(tfm::format(__VA_ARGS__)); \
+} while(0)
template<typename... Args>
bool error(const char* fmt, const Args&... args)