diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-06-27 18:39:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-06-27 18:39:25 +0200 |
commit | a5072a773071b8f4b644f84a77643e2ad18dba3a (patch) | |
tree | 436173f8092d054d7b26cb53eea3fe19f8c0e659 /src/util.h | |
parent | 695041e4952ea40e02e3b0431d04ca6af7ec9711 (diff) |
util: Remove zero-argument versions of LogPrint and error
Changes in tinyformat, recently imported from upstream have made the
zero-argument versions of formatting functions unnecessary. Remove them.
This is a slight semantic change: `%` characters in the zero-argument
call are now regarded and need to be escaped. As for as I know, the only
use of this is in `main.cpp`.
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/util.h b/src/util.h index ac4b947785..39328b51ef 100644 --- a/src/util.h +++ b/src/util.h @@ -77,33 +77,17 @@ int LogPrintStr(const std::string &str); #define LogPrintf(...) LogPrint(NULL, __VA_ARGS__) -template<typename T1, typename... Args> -static inline int LogPrint(const char* category, const char* fmt, const T1& v1, const Args&... 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, v1, args...)); + return LogPrintStr(tfm::format(fmt, args...)); } -template<typename T1, typename... Args> -bool error(const char* fmt, const T1& v1, const Args&... args) +template<typename... Args> +bool error(const char* fmt, const Args&... args) { - LogPrintStr("ERROR: " + tfm::format(fmt, v1, args...) + "\n"); - return false; -} - -/** - * Zero-arg versions of logging and error, these are not covered by - * the variadic templates above (and don't take format arguments but - * bare strings). - */ -static inline int LogPrint(const char* category, const char* s) -{ - if(!LogAcceptCategory(category)) return 0; - return LogPrintStr(s); -} -static inline bool error(const char* s) -{ - LogPrintStr(std::string("ERROR: ") + s + "\n"); + LogPrintStr("ERROR: " + tfm::format(fmt, args...) + "\n"); return false; } |