diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-01-05 10:46:54 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-01-05 10:49:00 +0100 |
| commit | c4b7d4f79c85bef332858579698f3ec7fd36f68b (patch) | |
| tree | 5c7bc72bde389848fe1a211ba82d3c7016088bc7 /src | |
| parent | Merge #9474: Mark the minconf parameter to move as ignored (diff) | |
| parent | Do not evaluate hidden LogPrint arguments (diff) | |
| download | discoin-c4b7d4f79c85bef332858579698f3ec7fd36f68b.tar.xz discoin-c4b7d4f79c85bef332858579698f3ec7fd36f68b.zip | |
Merge #9417: Do not evaluate hidden LogPrint arguments
407cdd6 Do not evaluate hidden LogPrint arguments (Pieter Wuille)
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/util.h b/src/util.h index 97d2723bc..e27ce121c 100644 --- a/src/util.h +++ b/src/util.h @@ -73,14 +73,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) |