aboutsummaryrefslogtreecommitdiff
path: root/src/bench
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-09-19 13:26:43 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-09-19 13:26:47 -0400
commit920c090f63f4990bf0f3b3d1a6d3d8a8bcd14ba0 (patch)
treeadb2d00ea06ac90008d158124f816d7f54d5d35c /src/bench
parent2796c6e5ec9055545e987023b04eb5ebe64d5320 (diff)
parentb6718e373ed425fa2440ddd8f1b05c76b782dc2b (diff)
Merge #14287: tests: Use MakeUnique to construct objects owned by unique_ptrs
b6718e373e tests: Use MakeUnique to construct objects owned by unique_ptrs (practicalswift) Pull request description: A subset of #14211 ("Use MakeUnique to construct objects owned by unique_ptrs") as suggested by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/14211#issuecomment-423324019. Use `MakeUnique` to construct objects owned by `unique_ptr`s. Rationale: * `MakeUnique` ensures exception safety in complex expressions. * `MakeUnique` gives a more concise statement of the construction. Tree-SHA512: 1228ae6ce7beb178d79142c4e936b728178ccaa8aa35c6d8feeb33d1a667abfdd010c59996a9d833594611e913877ce5794e75953d11d9b1fdbac04aa491d9cf
Diffstat (limited to 'src/bench')
-rw-r--r--src/bench/bench_bitcoin.cpp2
-rw-r--r--src/bench/coin_selection.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp
index d7b8083e7c..4fa516cb81 100644
--- a/src/bench/bench_bitcoin.cpp
+++ b/src/bench/bench_bitcoin.cpp
@@ -82,7 +82,7 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
- std::unique_ptr<benchmark::Printer> printer(new benchmark::ConsolePrinter());
+ std::unique_ptr<benchmark::Printer> printer = MakeUnique<benchmark::ConsolePrinter>();
std::string printer_arg = gArgs.GetArg("-printer", DEFAULT_BENCH_PRINTER);
if ("plot" == printer_arg) {
printer.reset(new benchmark::PlotlyPrinter(
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp
index 0a6f5d85ea..27c23d6834 100644
--- a/src/bench/coin_selection.cpp
+++ b/src/bench/coin_selection.cpp
@@ -66,7 +66,7 @@ static void add_coin(const CAmount& nValue, int nInput, std::vector<OutputGroup>
CMutableTransaction tx;
tx.vout.resize(nInput + 1);
tx.vout[nInput].nValue = nValue;
- std::unique_ptr<CWalletTx> wtx(new CWalletTx(&testWallet, MakeTransactionRef(std::move(tx))));
+ std::unique_ptr<CWalletTx> wtx = MakeUnique<CWalletTx>(&testWallet, MakeTransactionRef(std::move(tx)));
set.emplace_back(COutput(wtx.get(), nInput, 0, true, true, true).GetInputCoin(), 0, true, 0, 0);
wtxn.emplace_back(std::move(wtx));
}