Commit d21f7165 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

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
parent e65a4541
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <folly/portability/Sockets.h> #include <folly/portability/Sockets.h>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <memory>
enum StateEnum { enum StateEnum {
STATE_WAITING, STATE_WAITING,
...@@ -370,7 +371,7 @@ class TestServer { ...@@ -370,7 +371,7 @@ class TestServer {
std::shared_ptr<BlockingSocket> accept(int timeout=50) { std::shared_ptr<BlockingSocket> accept(int timeout=50) {
int fd = acceptFD(timeout); 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, std::shared_ptr<folly::AsyncSocket> acceptAsync(folly::EventBase* evb,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
// @author: Xin Liu <xliux@fb.com> // @author: Xin Liu <xliux@fb.com>
#include <map> #include <map>
#include <memory>
#include <random> #include <random>
#include <set> #include <set>
#include <thread> #include <thread>
...@@ -485,8 +486,7 @@ static std::map<int, std::shared_ptr<ConcurrentAccessData> > g_data; ...@@ -485,8 +486,7 @@ static std::map<int, std::shared_ptr<ConcurrentAccessData> > g_data;
static ConcurrentAccessData *mayInitTestData(int size) { static ConcurrentAccessData *mayInitTestData(int size) {
auto it = g_data.find(size); auto it = g_data.find(size);
if (it == g_data.end()) { if (it == g_data.end()) {
auto ptr = std::shared_ptr<ConcurrentAccessData>( auto ptr = std::make_shared<ConcurrentAccessData>(size);
new ConcurrentAccessData(size));
g_data[size] = ptr; g_data[size] = ptr;
return ptr.get(); return ptr.get();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment