summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-08-26 15:41:54 +0200
committerlouiz’ <louiz@louiz.org>2018-08-26 15:41:54 +0200
commit248e25c22fc15105d2a9db695ddb93ed5a8e0802 (patch)
tree66259fac4fd9a9b8bae087d46ec8b2f4c6305289 /src
parentf880428a5a8ff24d0d3df036c46edee0c8b2d49f (diff)
downloadbiboumi-248e25c22fc15105d2a9db695ddb93ed5a8e0802.tar.gz
biboumi-248e25c22fc15105d2a9db695ddb93ed5a8e0802.tar.bz2
biboumi-248e25c22fc15105d2a9db695ddb93ed5a8e0802.tar.xz
biboumi-248e25c22fc15105d2a9db695ddb93ed5a8e0802.zip
Replace a useless shared_ptr by a unique_ptr
Diffstat (limited to 'src')
-rw-r--r--src/bridge/bridge.cpp10
-rw-r--r--src/bridge/bridge.hpp6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index a69bdff..d7f5f16 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -63,7 +63,7 @@ void Bridge::shutdown(const std::string& exit_message)
{
for (auto& pair: this->irc_clients)
{
- std::shared_ptr<IrcClient>& irc = pair.second;
+ std::unique_ptr<IrcClient>& irc = pair.second;
irc->send_quit_command(exit_message);
}
}
@@ -134,11 +134,11 @@ IrcClient* Bridge::make_irc_client(const std::string& hostname, const std::strin
realname = this->get_bare_jid();
}
this->irc_clients.emplace(hostname,
- std::make_shared<IrcClient>(this->poller, hostname,
+ std::make_unique<IrcClient>(this->poller, hostname,
nickname, username,
realname, jid.domain,
*this));
- std::shared_ptr<IrcClient> irc = this->irc_clients.at(hostname);
+ std::unique_ptr<IrcClient>& irc = this->irc_clients.at(hostname);
return irc.get();
}
}
@@ -1151,12 +1151,12 @@ void Bridge::trigger_on_irc_message(const std::string& irc_hostname, const IrcMe
}
}
-std::unordered_map<std::string, std::shared_ptr<IrcClient>>& Bridge::get_irc_clients()
+std::unordered_map<std::string, std::unique_ptr<IrcClient>>& Bridge::get_irc_clients()
{
return this->irc_clients;
}
-const std::unordered_map<std::string, std::shared_ptr<IrcClient>>& Bridge::get_irc_clients() const
+const std::unordered_map<std::string, std::unique_ptr<IrcClient>>& Bridge::get_irc_clients() const
{
return this->irc_clients;
}
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index cb48a96..b2f7734 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -241,8 +241,8 @@ public:
* iq_responder_callback_t and remove the callback from the list.
*/
void trigger_on_irc_message(const std::string& irc_hostname, const IrcMessage& message);
- std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients();
- const std::unordered_map<std::string, std::shared_ptr<IrcClient>>& get_irc_clients() const;
+ std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients();
+ const std::unordered_map<std::string, std::unique_ptr<IrcClient>>& get_irc_clients() const;
std::set<char> get_chantypes(const std::string& hostname) const;
#ifdef USE_DATABASE
void set_record_history(const bool val);
@@ -275,7 +275,7 @@ private:
* One IrcClient for each IRC server we need to be connected to.
* The pointer is shared by the bridge and the poller.
*/
- std::unordered_map<std::string, std::shared_ptr<IrcClient>> irc_clients;
+ std::unordered_map<std::string, std::unique_ptr<IrcClient>> irc_clients;
/**
* To communicate back with the XMPP component
*/