Skip to content

Commit c4b7d4f

Browse files
committed
Merge #9417: Do not evaluate hidden LogPrint arguments
407cdd6 Do not evaluate hidden LogPrint arguments (Pieter Wuille)
2 parents 48d7e0d + 407cdd6 commit c4b7d4f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/util.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ bool LogAcceptCategory(const char* category);
7373
/** Send a string to the log output */
7474
int LogPrintStr(const std::string &str);
7575

76-
#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__)
77-
78-
template<typename... Args>
79-
static inline int LogPrint(const char* category, const char* fmt, const Args&... args)
80-
{
81-
if(!LogAcceptCategory(category)) return 0; \
82-
return LogPrintStr(tfm::format(fmt, args...));
83-
}
76+
#define LogPrint(category, ...) do { \
77+
if (LogAcceptCategory((category))) { \
78+
LogPrintStr(tfm::format(__VA_ARGS__)); \
79+
} \
80+
} while(0)
81+
82+
#define LogPrintf(...) do { \
83+
LogPrintStr(tfm::format(__VA_ARGS__)); \
84+
} while(0)
8485

8586
template<typename... Args>
8687
bool error(const char* fmt, const Args&... args)

0 commit comments

Comments
 (0)