Skip to content

Commit 407cdd6

Browse files
committed
Do not evaluate hidden LogPrint arguments
1 parent e8cfe1e commit 407cdd6

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
@@ -74,14 +74,15 @@ bool LogAcceptCategory(const char* category);
7474
/** Send a string to the log output */
7575
int LogPrintStr(const std::string &str);
7676

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

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

0 commit comments

Comments
 (0)