diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-10-28 15:09:56 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-10-28 15:10:06 -0400 |
commit | 4c1090c882ea15ba4d10a2f7f320f3c0eb490ebd (patch) | |
tree | 60332191fe0bd4c847c60dc6a4751f77e3be6e2a /src/bench | |
parent | cfec3e01b4d6153efecc1d767511c616029cb974 (diff) | |
parent | c72906dcc11a73fa06a0adf97557fa756b551bee (diff) |
Merge #17279: refactor: Remove redundant c_str() calls in formatting
c72906dcc11a73fa06a0adf97557fa756b551bee refactor: Remove redundant c_str() calls in formatting (Wladimir J. van der Laan)
Pull request description:
Our formatter, tinyformat, *never* needs `c_str()` for strings. Still, many places call it redundantly, resulting in longer code and a slight overhead.
Remove redundant `c_str()` calls for:
- `strprintf`
- `LogPrintf`
- `tfm::format`
(also, combined with #17095, I think this improves logging in case of unexpected embedded NULL characters)
ACKs for top commit:
ryanofsky:
Code review ACK c72906dcc11a73fa06a0adf97557fa756b551bee. Easy to review with `git log -p -n1 --word-diff-regex=. -U0 c72906dcc11a73fa06a0adf97557fa756b551bee`
Tree-SHA512: 9e21e7bed8aaff59b8b8aa11571396ddc265fb29608c2545b1fcdbbb36d65b37eb361db6688dd36035eab0c110f8de255375cfda50df3d9d7708bc092f67fefc
Diffstat (limited to 'src/bench')
-rw-r--r-- | src/bench/bench_bitcoin.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp index 655a5a3459..9235d5fe6a 100644 --- a/src/bench/bench_bitcoin.cpp +++ b/src/bench/bench_bitcoin.cpp @@ -36,7 +36,7 @@ int main(int argc, char** argv) SetupBenchArgs(); std::string error; if (!gArgs.ParseParameters(argc, argv, error)) { - tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error.c_str()); + tfm::format(std::cerr, "Error parsing command line arguments: %s\n", error); return EXIT_FAILURE; } @@ -60,7 +60,7 @@ int main(int argc, char** argv) double scaling_factor; if (!ParseDouble(scaling_str, &scaling_factor)) { - tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", scaling_str.c_str()); + tfm::format(std::cerr, "Error parsing scaling factor as double: %s\n", scaling_str); return EXIT_FAILURE; } |