From d21f716525c0b0a8aec9725ea39dc2a695267875 Mon Sep 17 00:00:00 2001 From: Christopher Dykes <cdykes@fb.com> Date: Mon, 23 Oct 2017 16:52:19 -0700 Subject: [PATCH] Modernize uses of std::make_shared Summary: Via the modernize-make-shared from clang-tidy Reviewed By: yfeldblum Differential Revision: D6129464 fbshipit-source-id: 04f560c6beeb2b8631b819fd4e6a2d51b37eeb4b --- folly/io/async/test/AsyncSocketTest.h | 3 ++- folly/test/ConcurrentSkipListBenchmark.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/folly/io/async/test/AsyncSocketTest.h b/folly/io/async/test/AsyncSocketTest.h index 95f302e4..f8c03f88 100644 --- a/folly/io/async/test/AsyncSocketTest.h +++ b/folly/io/async/test/AsyncSocketTest.h @@ -20,6 +20,7 @@ #include <folly/portability/Sockets.h> #include <boost/scoped_array.hpp> +#include <memory> enum StateEnum { STATE_WAITING, @@ -370,7 +371,7 @@ class TestServer { std::shared_ptr<BlockingSocket> accept(int timeout=50) { int fd = acceptFD(timeout); - return std::shared_ptr<BlockingSocket>(new BlockingSocket(fd)); + return std::make_shared<BlockingSocket>(fd); } std::shared_ptr<folly::AsyncSocket> acceptAsync(folly::EventBase* evb, diff --git a/folly/test/ConcurrentSkipListBenchmark.cpp b/folly/test/ConcurrentSkipListBenchmark.cpp index 09b9d17b..020a7bf7 100644 --- a/folly/test/ConcurrentSkipListBenchmark.cpp +++ b/folly/test/ConcurrentSkipListBenchmark.cpp @@ -17,6 +17,7 @@ // @author: Xin Liu <xliux@fb.com> #include <map> +#include <memory> #include <random> #include <set> #include <thread> @@ -485,8 +486,7 @@ static std::map<int, std::shared_ptr<ConcurrentAccessData> > g_data; static ConcurrentAccessData *mayInitTestData(int size) { auto it = g_data.find(size); if (it == g_data.end()) { - auto ptr = std::shared_ptr<ConcurrentAccessData>( - new ConcurrentAccessData(size)); + auto ptr = std::make_shared<ConcurrentAccessData>(size); g_data[size] = ptr; return ptr.get(); } -- 2.34.1