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