Pass the shared_ptr by reference, to avoid useless copies
This commit is contained in:
@@ -29,7 +29,7 @@ static std::string in_encoding_for(const Bridge& bridge, const Iid& iid)
|
||||
#endif
|
||||
}
|
||||
|
||||
Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller):
|
||||
Bridge::Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller):
|
||||
user_jid(user_jid),
|
||||
xmpp(xmpp),
|
||||
poller(poller)
|
||||
|
||||
@@ -38,7 +38,7 @@ using irc_responder_callback_t = std::function<bool(const std::string& irc_hostn
|
||||
class Bridge
|
||||
{
|
||||
public:
|
||||
explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller> poller);
|
||||
explicit Bridge(const std::string& user_jid, BiboumiComponent& xmpp, std::shared_ptr<Poller>& poller);
|
||||
~Bridge() = default;
|
||||
|
||||
Bridge(const Bridge&) = delete;
|
||||
|
||||
@@ -10,7 +10,7 @@ class BiboumiComponent;
|
||||
class IdentdServer: public TcpSocketServer<IdentdSocket>
|
||||
{
|
||||
public:
|
||||
IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr<Poller> poller, const uint16_t port):
|
||||
IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr<Poller>& poller, const uint16_t port):
|
||||
TcpSocketServer<IdentdSocket>(poller, port),
|
||||
biboumi_component(biboumi_component)
|
||||
{}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <logger/logger.hpp>
|
||||
|
||||
IdentdSocket::IdentdSocket(std::shared_ptr<Poller> poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server):
|
||||
IdentdSocket::IdentdSocket(std::shared_ptr<Poller>& poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server):
|
||||
TCPSocketHandler(poller),
|
||||
server(dynamic_cast<IdentdServer&>(server))
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class TcpSocketServer;
|
||||
class IdentdSocket: public TCPSocketHandler
|
||||
{
|
||||
public:
|
||||
IdentdSocket(std::shared_ptr<Poller> poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server);
|
||||
IdentdSocket(std::shared_ptr<Poller>& poller, const socket_t socket, TcpSocketServer<IdentdSocket>& server);
|
||||
~IdentdSocket() = default;
|
||||
std::string generate_answer(const BiboumiComponent& biboumi, uint16_t local, uint16_t remote);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ static const std::unordered_map<std::string,
|
||||
{"502", {&IrcClient::on_generic_error, {2, 0}}},
|
||||
};
|
||||
|
||||
IrcClient::IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname,
|
||||
IrcClient::IrcClient(std::shared_ptr<Poller>& poller, const std::string& hostname,
|
||||
const std::string& nickname, const std::string& username,
|
||||
const std::string& realname, const std::string& user_hostname,
|
||||
Bridge& bridge):
|
||||
|
||||
@@ -26,7 +26,7 @@ class Bridge;
|
||||
class IrcClient: public TCPClientSocketHandler
|
||||
{
|
||||
public:
|
||||
explicit IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname,
|
||||
explicit IrcClient(std::shared_ptr<Poller>& poller, const std::string& hostname,
|
||||
const std::string& nickname, const std::string& username,
|
||||
const std::string& realname, const std::string& user_hostname,
|
||||
Bridge& bridge);
|
||||
|
||||
@@ -44,7 +44,7 @@ static std::set<std::string> kickable_errors{
|
||||
};
|
||||
|
||||
|
||||
BiboumiComponent::BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret):
|
||||
BiboumiComponent::BiboumiComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret):
|
||||
XmppComponent(poller, hostname, secret),
|
||||
irc_server_adhoc_commands_handler(*this),
|
||||
irc_channel_adhoc_commands_handler(*this)
|
||||
|
||||
@@ -27,7 +27,7 @@ using iq_responder_callback_t = std::function<void(Bridge* bridge, const Stanza&
|
||||
class BiboumiComponent: public XmppComponent
|
||||
{
|
||||
public:
|
||||
explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
|
||||
explicit BiboumiComponent(std::shared_ptr<Poller>& poller, const std::string& hostname, const std::string& secret);
|
||||
~BiboumiComponent() = default;
|
||||
|
||||
BiboumiComponent(const BiboumiComponent&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user