Browse Source

Merge #9417: Do not evaluate hidden LogPrint arguments

407cdd6 Do not evaluate hidden LogPrint arguments (Pieter Wuille)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
c4b7d4f79c
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 17
      src/util.h

17
src/util.h

@ -73,14 +73,15 @@ bool LogAcceptCategory(const char* category); @@ -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)

Loading…
Cancel
Save