Skip to content

Commit 2713458

Browse files
committed
util: Remove zero-argument versions of LogPrint and error
backports bitcoin/bitcoin@a5072a7
1 parent 500dfee commit 2713458

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

src/util.h

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,34 +67,17 @@ int LogPrintStr(const std::string& str);
6767
/** Get format string from VA_ARGS for error reporting */
6868
template<typename... Args> std::string FormatStringFromLogArgs(const char *fmt, const Args&... args) { return fmt; }
6969

70-
template<typename T1, typename... Args>
71-
static inline int LogPrint(const char* category, const char* fmt, const T1& v1, const Args&... args)
70+
template<typename... Args>
71+
static inline int LogPrint(const char* category, const char* fmt, const Args&... args)
7272
{
7373
if(!LogAcceptCategory(category)) return 0; \
74-
return LogPrintStr(tfm::format(fmt, v1, args...));
74+
return LogPrintStr(tfm::format(fmt, args...));
7575
}
7676

77-
template<typename T1, typename... Args>
78-
bool error(const char* fmt, const T1& v1, const Args&... args)
77+
template<typename... Args>
78+
bool error(const char* fmt, const Args&... args)
7979
{
80-
LogPrintStr("ERROR: " + tfm::format(fmt, v1, args...) + "\n");
81-
return false;
82-
}
83-
84-
/**
85-
* Zero-arg versions of logging and error, these are not covered by
86-
* the variadic templates above (and don't take format arguments but
87-
* bare strings)
88-
*/
89-
static inline int LogPrint(const char* category, const char* s)
90-
{
91-
if (!LogAcceptCategory(category)) return 0;
92-
return LogPrintStr(s);
93-
}
94-
95-
static inline bool error(const char* s)
96-
{
97-
LogPrintStr(std::string("ERROR: ") + s + "\n");
80+
LogPrintStr("ERROR: " + tfm::format(fmt, args...) + "\n");
9881
return false;
9982
}
10083

0 commit comments

Comments
 (0)