Skip to content

Commit bc0dc57

Browse files
authored
Merge pull request #814 from stefan-floeren/develop
Replace make_shared with new in some cases
2 parents 275e88a + f810ca2 commit bc0dc57

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
206206
endif ()
207207

208208
if (NOT Boost_USE_STATIC_LIBS)
209-
add_definitions (/DBOOST_TEST_DYN_LINK)
209+
add_definitions (-DBOOST_TEST_DYN_LINK)
210210
endif ()
211211

212212
set (Boost_FIND_REQUIRED TRUE)

websocketpp/transport/asio/connection.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ class connection : public config::socket_type::socket_con_type {
311311
* needed.
312312
*/
313313
timer_ptr set_timer(long duration, timer_handler callback) {
314-
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>(
315-
lib::ref(*m_io_service),
316-
lib::asio::milliseconds(duration)
314+
timer_ptr new_timer(
315+
new lib::asio::steady_timer(
316+
*m_io_service,
317+
lib::asio::milliseconds(duration))
317318
);
318319

319320
if (config::enable_multithreading) {
@@ -461,8 +462,7 @@ class connection : public config::socket_type::socket_con_type {
461462
m_io_service = io_service;
462463

463464
if (config::enable_multithreading) {
464-
m_strand = lib::make_shared<lib::asio::io_service::strand>(
465-
lib::ref(*io_service));
465+
m_strand.reset(new lib::asio::io_service::strand(*io_service));
466466
}
467467

468468
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,

websocketpp/transport/asio/endpoint.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ class endpoint : public config::socket_type {
195195

196196
m_io_service = ptr;
197197
m_external_io_service = true;
198-
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>(
199-
lib::ref(*m_io_service));
198+
m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
200199

201200
m_state = READY;
202201
ec = lib::error_code();
@@ -688,9 +687,7 @@ class endpoint : public config::socket_type {
688687
* @since 0.3.0
689688
*/
690689
void start_perpetual() {
691-
m_work = lib::make_shared<lib::asio::io_service::work>(
692-
lib::ref(*m_io_service)
693-
);
690+
m_work.reset(new lib::asio::io_service::work(*m_io_service));
694691
}
695692

696693
/// Clears the endpoint's perpetual flag, allowing it to exit when empty
@@ -854,8 +851,7 @@ class endpoint : public config::socket_type {
854851

855852
// Create a resolver
856853
if (!m_resolver) {
857-
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>(
858-
lib::ref(*m_io_service));
854+
m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
859855
}
860856

861857
tcon->set_uri(u);

websocketpp/transport/asio/security/none.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ class connection : public lib::enable_shared_from_this<connection> {
168168
return socket::make_error_code(socket::error::invalid_state);
169169
}
170170

171-
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(
172-
lib::ref(*service));
171+
m_socket.reset(new lib::asio::ip::tcp::socket(*service));
173172

174173
if (m_socket_init_handler) {
175174
m_socket_init_handler(m_hdl, *m_socket);

websocketpp/transport/asio/security/tls.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ class connection : public lib::enable_shared_from_this<connection> {
193193
if (!m_context) {
194194
return socket::make_error_code(socket::error::invalid_tls_context);
195195
}
196-
m_socket = lib::make_shared<socket_type>(
197-
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
196+
m_socket.reset(new socket_type(*service, *m_context));
198197

199198
if (m_socket_init_handler) {
200199
m_socket_init_handler(m_hdl, get_socket());

0 commit comments

Comments
 (0)