diff --git a/src/httprpc.cpp b/src/httprpc.cpp --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -393,7 +393,8 @@ RegisterHTTPHandler("/wallet/", false, rpcFunction); #endif assert(EventBase()); - httpRPCTimerInterface = MakeUnique(EventBase()); + httpRPCTimerInterface = + std::make_unique(EventBase()); RPCSetTimerInterface(httpRPCTimerInterface.get()); return true; } diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -2468,12 +2468,12 @@ if (semOutbound == nullptr) { // initialize semaphore - semOutbound = MakeUnique( + semOutbound = std::make_unique( std::min((nMaxOutbound + nMaxFeeler), nMaxConnections)); } if (semAddnode == nullptr) { // initialize semaphore - semAddnode = MakeUnique(nMaxAddnode); + semAddnode = std::make_unique(nMaxAddnode); } // @@ -2897,7 +2897,7 @@ nNextInvSend = 0; fRelayTxes = false; fSentAddr = false; - pfilter = MakeUnique(); + pfilter = std::make_unique(); timeLastMempoolReq = 0; nLastBlockTime = 0; nLastTXTime = 0; diff --git a/src/radix.h b/src/radix.h --- a/src/radix.h +++ b/src/radix.h @@ -175,7 +175,7 @@ // There is an element there, but it isn't a subtree. We need to // convert it into a subtree and resume insertion into that subtree. std::unique_ptr newChild = - MakeUnique(level, leafKey, e); + std::make_unique(level, leafKey, e); if (eptr->compare_exchange_strong(e, RadixElement(newChild.get()))) { // We have a subtree, resume normal operations from there. diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -124,7 +124,7 @@ // Set up a non-obfuscated wrapper to write some initial data. std::unique_ptr dbw = - MakeUnique(ph, (1 << 10), false, false, false); + std::make_unique(ph, (1 << 10), false, false, false); char key = 'k'; uint256 in = InsecureRand256(); uint256 res; @@ -167,7 +167,7 @@ // Set up a non-obfuscated wrapper to write some initial data. std::unique_ptr dbw = - MakeUnique(ph, (1 << 10), false, false, false); + std::make_unique(ph, (1 << 10), false, false, false); char key = 'k'; uint256 in = InsecureRand256(); uint256 res; diff --git a/src/test/rpc_server_tests.cpp b/src/test/rpc_server_tests.cpp --- a/src/test/rpc_server_tests.cpp +++ b/src/test/rpc_server_tests.cpp @@ -35,7 +35,8 @@ DummyConfig config; RPCServer rpcServer; const std::string commandName = "testcommand1"; - rpcServer.RegisterCommand(MakeUnique(commandName)); + rpcServer.RegisterCommand( + std::make_unique(commandName)); UniValue args(UniValue::VOBJ); args.pushKV("arg1", "value1"); @@ -73,7 +74,7 @@ RPCServer rpcServer; const std::string commandName = "testcommand2"; rpcServer.RegisterCommand( - MakeUnique(commandName)); + std::make_unique(commandName)); UniValue args(UniValue::VOBJ); args.pushKV("arg2", "value2"); diff --git a/src/util.h b/src/util.h --- a/src/util.h +++ b/src/util.h @@ -272,10 +272,4 @@ std::string CopyrightHolders(const std::string &strPrefix); -//! Substitute for C++14 std::make_unique. -template -std::unique_ptr MakeUnique(Args &&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - #endif // BITCOIN_UTIL_H diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -230,7 +230,7 @@ } LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size()); - std::unique_ptr pdbCopy = MakeUnique(bitdb.dbenv.get(), 0); + std::unique_ptr pdbCopy = std::make_unique(bitdb.dbenv.get(), 0); int ret = pdbCopy->open(nullptr, // Txn pointer filename.c_str(), // Filename "main", // Logical db name @@ -438,7 +438,8 @@ pdb = env->mapDb[strFilename]; if (pdb == nullptr) { - std::unique_ptr pdb_temp = MakeUnique(env->dbenv.get(), 0); + std::unique_ptr pdb_temp = + std::make_unique(env->dbenv.get(), 0); bool fMockDb = env->IsMock(); if (fMockDb) { @@ -554,7 +555,7 @@ // surround usage of db with extra {} CDB db(dbw, "r"); std::unique_ptr pdbCopy = - MakeUnique(env->dbenv.get(), 0); + std::make_unique(env->dbenv.get(), 0); int ret = pdbCopy->open(nullptr, // Txn pointer strFileRes.c_str(), // Filename diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp --- a/src/wallet/test/wallet_test_fixture.cpp +++ b/src/wallet/test/wallet_test_fixture.cpp @@ -19,7 +19,7 @@ bool fFirstRun; std::unique_ptr dbw( new CWalletDBWrapper(&bitdb, "wallet_test.dat")); - pwalletMain = MakeUnique(Params(), std::move(dbw)); + pwalletMain = std::make_unique(Params(), std::move(dbw)); pwalletMain->LoadWallet(fFirstRun); RegisterValidationInterface(pwalletMain.get()); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4170,7 +4170,7 @@ std::unique_ptr dbw( new CWalletDBWrapper(&bitdb, walletFile)); std::unique_ptr tempWallet = - MakeUnique(chainParams, std::move(dbw)); + std::make_unique(chainParams, std::move(dbw)); DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx); if (nZapWalletRet != DBErrors::LOAD_OK) { InitError(