diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-10-28 13:30:20 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-10-28 13:31:33 +0100 |
commit | c72906dcc11a73fa06a0adf97557fa756b551bee (patch) | |
tree | 2cfc335a4d7a75a0bbf20b8d49f04f987ec7266f /src/util/system.cpp | |
parent | a25945318fdc2890a141a28843c2c5af251c9605 (diff) |
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`
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r-- | src/util/system.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 526bf559c3..7da408eda5 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -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; |