mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
refactor: Remove redundant c_str() calls in formatting
Our formatter, tinyformat, *never* needs `c_str()` for strings. Remove redundant `c_str()` calls for: - `strprintf` - `LogPrintf` - `tfm::format`
This commit is contained in:
@@ -305,7 +305,7 @@ NODISCARD static bool InterpretOption(std::string key, std::string val, unsigned
|
||||
LogPrintf("Warning: parsed potentially confusing double-negative %s=%s\n", key, val);
|
||||
val = "1";
|
||||
} else {
|
||||
error = strprintf("Negating of %s is meaningless and therefore forbidden", key.c_str());
|
||||
error = strprintf("Negating of %s is meaningless and therefore forbidden", key);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -414,7 +414,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
error = strprintf("Invalid parameter %s", key.c_str());
|
||||
error = strprintf("Invalid parameter %s", key);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -688,7 +688,7 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
|
||||
{
|
||||
std::string message = FormatException(pex, pszThread);
|
||||
LogPrintf("\n\n************************\n%s\n", message);
|
||||
tfm::format(std::cerr, "\n\n************************\n%s\n", message.c_str());
|
||||
tfm::format(std::cerr, "\n\n************************\n%s\n", message);
|
||||
}
|
||||
|
||||
fs::path GetDefaultDataDir()
|
||||
@@ -870,7 +870,7 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& file
|
||||
if (ignore_invalid_keys) {
|
||||
LogPrintf("Ignoring unknown configuration value %s\n", option.first);
|
||||
} else {
|
||||
error = strprintf("Invalid configuration value %s", option.first.c_str());
|
||||
error = strprintf("Invalid configuration value %s", option.first);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -925,7 +925,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
|
||||
if (!ReadConfigStream(include_config, to_include, error, ignore_invalid_keys)) {
|
||||
return false;
|
||||
}
|
||||
LogPrintf("Included configuration file %s\n", to_include.c_str());
|
||||
LogPrintf("Included configuration file %s\n", to_include);
|
||||
} else {
|
||||
error = "Failed to include configuration file " + to_include;
|
||||
return false;
|
||||
@@ -945,7 +945,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
|
||||
}
|
||||
}
|
||||
for (const std::string& to_include : includeconf) {
|
||||
tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", to_include.c_str());
|
||||
tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", to_include);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -953,7 +953,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
|
||||
// If datadir is changed in .conf file:
|
||||
ClearDatadirCache();
|
||||
if (!CheckDataDirOption()) {
|
||||
error = strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", "").c_str());
|
||||
error = strprintf("specified data directory \"%s\" does not exist.", gArgs.GetArg("-datadir", ""));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user