Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
This commit is contained in:
16
src/db.cpp
16
src/db.cpp
@@ -75,7 +75,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
|
||||
filesystem::path pathLogDir = path / "database";
|
||||
filesystem::create_directory(pathLogDir);
|
||||
filesystem::path pathErrorFile = path / "db.log";
|
||||
LogPrintf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string().c_str(), pathErrorFile.string().c_str());
|
||||
LogPrintf("dbenv.open LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
|
||||
|
||||
unsigned int nEnvFlags = 0;
|
||||
if (GetBoolArg("-privdb", true))
|
||||
@@ -353,7 +353,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
|
||||
bitdb.mapFileUseCount.erase(strFile);
|
||||
|
||||
bool fSuccess = true;
|
||||
LogPrintf("Rewriting %s...\n", strFile.c_str());
|
||||
LogPrintf("Rewriting %s...\n", strFile);
|
||||
string strFileRes = strFile + ".rewrite";
|
||||
{ // surround usage of db with extra {}
|
||||
CDB db(strFile.c_str(), "r");
|
||||
@@ -367,7 +367,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
|
||||
0);
|
||||
if (ret > 0)
|
||||
{
|
||||
LogPrintf("Cannot create database file %s\n", strFileRes.c_str());
|
||||
LogPrintf("Cannot create database file %s\n", strFileRes);
|
||||
fSuccess = false;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
|
||||
fSuccess = false;
|
||||
}
|
||||
if (!fSuccess)
|
||||
LogPrintf("Rewriting of %s FAILED!\n", strFileRes.c_str());
|
||||
LogPrintf("Rewriting of %s FAILED!\n", strFileRes);
|
||||
return fSuccess;
|
||||
}
|
||||
}
|
||||
@@ -448,17 +448,17 @@ void CDBEnv::Flush(bool fShutdown)
|
||||
{
|
||||
string strFile = (*mi).first;
|
||||
int nRefCount = (*mi).second;
|
||||
LogPrint("db", "%s refcount=%d\n", strFile.c_str(), nRefCount);
|
||||
LogPrint("db", "%s refcount=%d\n", strFile, nRefCount);
|
||||
if (nRefCount == 0)
|
||||
{
|
||||
// Move log data to the dat file
|
||||
CloseDb(strFile);
|
||||
LogPrint("db", "%s checkpoint\n", strFile.c_str());
|
||||
LogPrint("db", "%s checkpoint\n", strFile);
|
||||
dbenv.txn_checkpoint(0, 0, 0);
|
||||
LogPrint("db", "%s detach\n", strFile.c_str());
|
||||
LogPrint("db", "%s detach\n", strFile);
|
||||
if (!fMockDb)
|
||||
dbenv.lsn_reset(strFile.c_str(), 0);
|
||||
LogPrint("db", "%s closed\n", strFile.c_str());
|
||||
LogPrint("db", "%s closed\n", strFile);
|
||||
mapFileUseCount.erase(mi++);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user