Commit bfb98fab authored by Rosen Penev's avatar Rosen Penev Committed by Facebook Github Bot

pass by value (#1299)

Summary:
Found with modernize-pass-by-value
Signed-off-by: default avatarRosen Penev <rosenp@gmail.com>
Pull Request resolved: https://github.com/facebook/folly/pull/1299

Differential Revision: D19270977

Pulled By: yfeldblum

fbshipit-source-id: 77c33a3425376838fa3c7b04b166137eb74f63ba
parent 78cfa5e5
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <cerrno> #include <cerrno>
#include <chrono> #include <chrono>
#include <memory> #include <memory>
#include <utility>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/Indestructible.h> #include <folly/Indestructible.h>
...@@ -220,11 +221,11 @@ namespace folly { ...@@ -220,11 +221,11 @@ namespace folly {
* Create a client AsyncSSLSocket * Create a client AsyncSSLSocket
*/ */
AsyncSSLSocket::AsyncSSLSocket( AsyncSSLSocket::AsyncSSLSocket(
const shared_ptr<SSLContext>& ctx, shared_ptr<SSLContext> ctx,
EventBase* evb, EventBase* evb,
bool deferSecurityNegotiation) bool deferSecurityNegotiation)
: AsyncSocket(evb), : AsyncSocket(evb),
ctx_(ctx), ctx_(std::move(ctx)),
handshakeTimeout_(this, evb), handshakeTimeout_(this, evb),
connectionTimeout_(this, evb) { connectionTimeout_(this, evb) {
init(); init();
...@@ -237,14 +238,14 @@ AsyncSSLSocket::AsyncSSLSocket( ...@@ -237,14 +238,14 @@ AsyncSSLSocket::AsyncSSLSocket(
* Create a server/client AsyncSSLSocket * Create a server/client AsyncSSLSocket
*/ */
AsyncSSLSocket::AsyncSSLSocket( AsyncSSLSocket::AsyncSSLSocket(
const shared_ptr<SSLContext>& ctx, shared_ptr<SSLContext> ctx,
EventBase* evb, EventBase* evb,
NetworkSocket fd, NetworkSocket fd,
bool server, bool server,
bool deferSecurityNegotiation) bool deferSecurityNegotiation)
: AsyncSocket(evb, fd), : AsyncSocket(evb, fd),
server_(server), server_(server),
ctx_(ctx), ctx_(std::move(ctx)),
handshakeTimeout_(this, evb), handshakeTimeout_(this, evb),
connectionTimeout_(this, evb) { connectionTimeout_(this, evb) {
noTransparentTls_ = true; noTransparentTls_ = true;
...@@ -259,13 +260,13 @@ AsyncSSLSocket::AsyncSSLSocket( ...@@ -259,13 +260,13 @@ AsyncSSLSocket::AsyncSSLSocket(
} }
AsyncSSLSocket::AsyncSSLSocket( AsyncSSLSocket::AsyncSSLSocket(
const shared_ptr<SSLContext>& ctx, shared_ptr<SSLContext> ctx,
AsyncSocket::UniquePtr oldAsyncSocket, AsyncSocket::UniquePtr oldAsyncSocket,
bool server, bool server,
bool deferSecurityNegotiation) bool deferSecurityNegotiation)
: AsyncSocket(std::move(oldAsyncSocket)), : AsyncSocket(std::move(oldAsyncSocket)),
server_(server), server_(server),
ctx_(ctx), ctx_(std::move(ctx)),
handshakeTimeout_(this, AsyncSocket::getEventBase()), handshakeTimeout_(this, AsyncSocket::getEventBase()),
connectionTimeout_(this, AsyncSocket::getEventBase()) { connectionTimeout_(this, AsyncSocket::getEventBase()) {
noTransparentTls_ = true; noTransparentTls_ = true;
......
...@@ -195,7 +195,7 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -195,7 +195,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
* Create a client AsyncSSLSocket * Create a client AsyncSSLSocket
*/ */
AsyncSSLSocket( AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx, std::shared_ptr<folly::SSLContext> ctx,
EventBase* evb, EventBase* evb,
bool deferSecurityNegotiation = false); bool deferSecurityNegotiation = false);
...@@ -217,7 +217,7 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -217,7 +217,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
* unencrypted data can be sent before sslConn/Accept * unencrypted data can be sent before sslConn/Accept
*/ */
AsyncSSLSocket( AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx, std::shared_ptr<folly::SSLContext> ctx,
EventBase* evb, EventBase* evb,
NetworkSocket fd, NetworkSocket fd,
bool server = true, bool server = true,
...@@ -228,7 +228,7 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -228,7 +228,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
* AsyncSocket. * AsyncSocket.
*/ */
AsyncSSLSocket( AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx, std::shared_ptr<folly::SSLContext> ctx,
AsyncSocket::UniquePtr oldAsyncSocket, AsyncSocket::UniquePtr oldAsyncSocket,
bool server = true, bool server = true,
bool deferSecurityNegotiation = false); bool deferSecurityNegotiation = false);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <folly/logging/LogMessage.h> #include <folly/logging/LogMessage.h>
#include <folly/logging/LogWriter.h> #include <folly/logging/LogWriter.h>
#include <utility>
namespace folly { namespace folly {
StandardLogHandler::StandardLogHandler( StandardLogHandler::StandardLogHandler(
...@@ -30,7 +32,7 @@ StandardLogHandler::StandardLogHandler( ...@@ -30,7 +32,7 @@ StandardLogHandler::StandardLogHandler(
: syncLevel_(syncLevel), : syncLevel_(syncLevel),
formatter_{std::move(formatter)}, formatter_{std::move(formatter)},
writer_{std::move(writer)}, writer_{std::move(writer)},
config_{config} {} config_{std::move(config)} {}
StandardLogHandler::~StandardLogHandler() = default; StandardLogHandler::~StandardLogHandler() = default;
......
...@@ -117,8 +117,8 @@ void ThreadSyncVar::acq_rel() { ...@@ -117,8 +117,8 @@ void ThreadSyncVar::acq_rel() {
} }
DeterministicSchedule::DeterministicSchedule( DeterministicSchedule::DeterministicSchedule(
const std::function<size_t(size_t)>& scheduler) std::function<size_t(size_t)> scheduler)
: scheduler_(scheduler), nextThreadId_(0), step_(0) { : scheduler_(std::move(scheduler)), nextThreadId_(0), step_(0) {
auto& tls = TLState::get(); auto& tls = TLState::get();
assert(tls.sem == nullptr); assert(tls.sem == nullptr);
assert(tls.sched == nullptr); assert(tls.sched == nullptr);
......
...@@ -153,8 +153,7 @@ class DeterministicSchedule { ...@@ -153,8 +153,7 @@ class DeterministicSchedule {
* DeterministicSchedule::thread on a thread participating in this * DeterministicSchedule::thread on a thread participating in this
* schedule) to participate in a deterministic schedule. * schedule) to participate in a deterministic schedule.
*/ */
explicit DeterministicSchedule( explicit DeterministicSchedule(std::function<size_t(size_t)> scheduler);
const std::function<size_t(size_t)>& scheduler);
DeterministicSchedule(const DeterministicSchedule&) = delete; DeterministicSchedule(const DeterministicSchedule&) = delete;
DeterministicSchedule& operator=(const DeterministicSchedule&) = delete; DeterministicSchedule& operator=(const DeterministicSchedule&) = delete;
......
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