Skip to content

Commit a5072a7

Browse files
committed
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`.
1 parent 695041e commit a5072a7

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,7 +4159,7 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview,
41594159
int nGoodTransactions = 0;
41604160
CValidationState state;
41614161
int reportDone = 0;
4162-
LogPrintf("[0%]...");
4162+
LogPrintf("[0%%]...");
41634163
for (CBlockIndex* pindex = chainActive.Tip(); pindex && pindex->pprev; pindex = pindex->pprev)
41644164
{
41654165
boost::this_thread::interruption_point();

src/util.h

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,33 +77,17 @@ int LogPrintStr(const std::string &str);
7777

7878
#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__)
7979

80-
template<typename T1, typename... Args>
81-
static inline int LogPrint(const char* category, const char* fmt, const T1& v1, const Args&... args)
80+
template<typename... Args>
81+
static inline int LogPrint(const char* category, const char* fmt, const Args&... args)
8282
{
8383
if(!LogAcceptCategory(category)) return 0; \
84-
return LogPrintStr(tfm::format(fmt, v1, args...));
84+
return LogPrintStr(tfm::format(fmt, args...));
8585
}
8686

87-
template<typename T1, typename... Args>
88-
bool error(const char* fmt, const T1& v1, const Args&... args)
87+
template<typename... Args>
88+
bool error(const char* fmt, const Args&... args)
8989
{
90-
LogPrintStr("ERROR: " + tfm::format(fmt, v1, args...) + "\n");
91-
return false;
92-
}
93-
94-
/**
95-
* Zero-arg versions of logging and error, these are not covered by
96-
* the variadic templates above (and don't take format arguments but
97-
* bare strings).
98-
*/
99-
static inline int LogPrint(const char* category, const char* s)
100-
{
101-
if(!LogAcceptCategory(category)) return 0;
102-
return LogPrintStr(s);
103-
}
104-
static inline bool error(const char* s)
105-
{
106-
LogPrintStr(std::string("ERROR: ") + s + "\n");
90+
LogPrintStr("ERROR: " + tfm::format(fmt, args...) + "\n");
10791
return false;
10892
}
10993

0 commit comments

Comments
 (0)