diff --git a/src/httpserver.cpp b/src/httpserver.cpp --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -228,7 +228,7 @@ } } } - std::unique_ptr hreq(new HTTPRequest(req)); + auto hreq = std::make_unique(req); LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n", RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1939,9 +1939,9 @@ // need to reindex later. assert(!g_connman); - g_connman = std::unique_ptr( - new CConnman(config, GetRand(std::numeric_limits::max()), - GetRand(std::numeric_limits::max()))); + g_connman = std::make_unique( + config, GetRand(std::numeric_limits::max()), + GetRand(std::numeric_limits::max())); CConnman &connman = *g_connman; peerLogic.reset(new PeerLogicValidation( diff --git a/src/radix.h b/src/radix.h --- a/src/radix.h +++ b/src/radix.h @@ -174,8 +174,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 = - std::make_unique(level, leafKey, e); + auto newChild = 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/net_tests.cpp b/src/test/net_tests.cpp --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -183,16 +183,16 @@ bool fInboundIn = false; // Test that fFeeler is false by default. - std::unique_ptr pnode1(new CNode(id++, NODE_NETWORK, height, hSocket, - addr, 0, 0, CAddress(), pszDest, - fInboundIn)); + auto pnode1 = + std::make_unique(id++, NODE_NETWORK, height, hSocket, addr, 0, 0, + CAddress(), pszDest, fInboundIn); BOOST_CHECK(pnode1->fInbound == false); BOOST_CHECK(pnode1->fFeeler == false); fInboundIn = true; - std::unique_ptr pnode2(new CNode(id++, NODE_NETWORK, height, hSocket, - addr, 1, 1, CAddress(), pszDest, - fInboundIn)); + auto pnode2 = + std::make_unique(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, + CAddress(), pszDest, fInboundIn); BOOST_CHECK(pnode2->fInbound == true); BOOST_CHECK(pnode2->fFeeler == false); } diff --git a/src/test/work_comparator_tests.cpp b/src/test/work_comparator_tests.cpp --- a/src/test/work_comparator_tests.cpp +++ b/src/test/work_comparator_tests.cpp @@ -43,8 +43,8 @@ } // All else equal, so checking pointer address as final check - std::unique_ptr pindexA(new CBlockIndex()); - std::unique_ptr pindexB(new CBlockIndex()); + auto pindexA = std::make_unique(); + auto pindexB = std::make_unique(); if (pindexA < pindexB) { BOOST_CHECK(CBlockIndexWorkComparator()(pindexB.get(), pindexA.get())); } else {