Skip to content

Commit 66ec97b

Browse files
committed
Do not evaluate hidden LogPrint arguments
backports bitcoin/bitcoin@407cdd6
1 parent 2713458 commit 66ec97b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/util.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ bool LogAcceptCategory(const char* category);
6262
/** Send a string to the log output */
6363
int LogPrintStr(const std::string& str);
6464

65-
#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__)
66-
67-
/** Get format string from VA_ARGS for error reporting */
68-
template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt, const Args&... args) { return fmt; }
69-
70-
template<typename... Args>
71-
static inline int LogPrint(const char* category, const char* fmt, const Args&... args)
72-
{
73-
if(!LogAcceptCategory(category)) return 0; \
74-
return LogPrintStr(tfm::format(fmt, args...));
75-
}
65+
#define LogPrint(category, ...) do { \
66+
if (LogAcceptCategory((category))) { \
67+
LogPrintStr(tfm::format(__VA_ARGS__)); \
68+
} \
69+
} while(0)
70+
71+
#define LogPrintf(...) do { \
72+
LogPrintStr(tfm::format(__VA_ARGS__)); \
73+
} while(0)
7674

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

0 commit comments

Comments
 (0)