From 569324feeecea939854e45bbd44495b849fcfd59 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 18 Apr 2021 04:37:51 +0100 Subject: Migrate collections from insert to emplace. --- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_pgsql.cpp | 2 +- src/modules/extra/m_sqlite3.cpp | 2 +- src/modules/m_alias.cpp | 2 +- src/modules/m_cap.cpp | 2 +- src/modules/m_chanlog.cpp | 2 +- src/modules/m_clearchan.cpp | 2 +- src/modules/m_customtitle.cpp | 2 +- src/modules/m_helpop.cpp | 4 ++-- src/modules/m_hidemode.cpp | 4 ++-- src/modules/m_httpd.cpp | 4 ++-- src/modules/m_ircv3_msgid.cpp | 2 +- src/modules/m_ircv3_servertime.cpp | 2 +- src/modules/m_monitor.cpp | 2 +- src/modules/m_silence.cpp | 4 ++-- src/modules/m_spanningtree/servercommand.cpp | 2 +- src/modules/m_spanningtree/treesocket2.cpp | 2 +- src/modules/m_vhost.cpp | 2 +- 18 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 6414434fb..7fedadc05 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -475,7 +475,7 @@ void ModuleSQL::ReadConfig(ConfigStatus& status) if (curr == connections.end()) { SQLConnection* conn = new SQLConnection(this, tag); - conns.insert(std::make_pair(id, conn)); + conns.emplace(id, conn); ServerInstance->Modules.AddService(*conn); } else diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 38b07b52e..9f512a21a 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -559,7 +559,7 @@ class ModulePgSQL : public Module SQLConn* conn = new SQLConn(this, tag); if (conn->status != DEAD) { - conns.insert(std::make_pair(id, conn)); + conns.emplace(id, conn); ServerInstance->Modules.AddService(*conn); } // If the connection is dead it has already been queued for culling diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 77d0e1272..260364ca8 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -262,7 +262,7 @@ class ModuleSQLite3 : public Module continue; SQLConn* conn = new SQLConn(this, tag); - conns.insert(std::make_pair(tag->getString("id"), conn)); + conns.emplace(tag->getString("id"), conn); ServerInstance->Modules.AddService(*conn); } } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 1a289a133..e04d3a3de 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -103,7 +103,7 @@ class ModuleAlias : public Module a.StripColor = tag->getBool("stripcolor"); std::transform(a.AliasedCommand.begin(), a.AliasedCommand.end(), a.AliasedCommand.begin(), ::toupper); - newAliases.insert(std::make_pair(a.AliasedCommand, a)); + newAliases.emplace(a.AliasedCommand, a); } auto fantasy = ServerInstance->Config->ConfValue("fantasy"); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 480dbc899..8ffc98890 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -166,7 +166,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Registering cap %s", cap->GetName().c_str()); cap->bit = AllocateBit(); cap->extitem = &capext; - caps.insert(std::make_pair(cap->GetName(), cap)); + caps.emplace(cap->GetName(), cap); ServerInstance->Modules.AddReferent("cap/" + cap->GetName(), cap); evprov.Call(&Cap::EventListener::OnCapAddDel, cap, true); diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 349e0be47..939010613 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -55,7 +55,7 @@ class ModuleChanLog : public Module for (const auto& snomask : snomasks) { - newlogs.insert(std::make_pair(snomask, channel)); + newlogs.emplace(snomask, channel); ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Logging %c to %s", snomask, channel.c_str()); } } diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index 543f47d3d..0d656a023 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -187,7 +187,7 @@ class ModuleClearChan : public Module // module before us doesn't want them to see it or added the exceptions already. // If there is a value for this oper in excepts already, this won't overwrite it. if (found) - exception.insert(std::make_pair(curr, true)); + exception.emplace(curr, true); continue; } else if (!include.empty() && curr->chans.size() > 1) diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 2f0265433..c4763b3fa 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -142,7 +142,7 @@ class ModuleCustomTitle : public Module, public Whois::LineEventListener std::string title = tag->getString("title"); std::string vhost = tag->getString("vhost"); CustomTitle config(name, pass, hash, host, title, vhost); - newtitles.insert(std::make_pair(name, config)); + newtitles.emplace(name, config); } cmd.configs.swap(newtitles); } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index c4087e36c..fe1a1ab96 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -144,7 +144,7 @@ class ModuleHelpop // Read the help title and store the topic. const std::string title = tag->getString("title", InspIRCd::Format("*** Help for %s", key.c_str()), 1); - if (!newhelp.insert(std::make_pair(key, HelpTopic(helpmsg, title))).second) + if (!newhelp.emplace(key, HelpTopic(helpmsg, title)).second) { throw ModuleException(InspIRCd::Format(" tag with duplicate key '%s' at %s", key.c_str(), tag->source.str().c_str())); @@ -169,7 +169,7 @@ class ModuleHelpop } indexmsg.push_back(indexline); } - newhelp.insert(std::make_pair("index", HelpTopic(indexmsg, "List of help topics"))); + newhelp.emplace("index", HelpTopic(indexmsg, "List of help topics")); cmd.help.swap(newhelp); auto tag = ServerInstance->Config->ConfValue("helpmsg"); diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index a8e35a029..906d5de31 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -53,7 +53,7 @@ class Settings throw ModuleException(" must be greater than 0 at " + tag->source.str()); ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %u", modename.c_str(), rank); - newranks.insert(std::make_pair(modename, rank)); + newranks.emplace(modename, rank); } rankstosee.swap(newranks); } @@ -167,7 +167,7 @@ class ModeHook : public ClientProtocol::EventHook } // Cache the result in all cases so it can be reused for further members with the same rank - cache.insert(std::make_pair(memb->getRank(), finalmsgplist)); + cache.emplace(memb->getRank(), finalmsgplist); return HandleResult(finalmsgplist, messagelist); } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index d3e910e48..340ac3c5e 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -375,11 +375,11 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru eq_pos = token.find('='); if (eq_pos == std::string::npos) { - out.query_params.insert(std::make_pair(token, "")); + out.query_params.emplace(token, ""); } else { - out.query_params.insert(std::make_pair(token.substr(0, eq_pos), token.substr(eq_pos + 1))); + out.query_params.emplace(token.substr(0, eq_pos), token.substr(eq_pos + 1)); } } return true; diff --git a/src/modules/m_ircv3_msgid.cpp b/src/modules/m_ircv3_msgid.cpp index df9ec26bd..965c089a8 100644 --- a/src/modules/m_ircv3_msgid.cpp +++ b/src/modules/m_ircv3_msgid.cpp @@ -88,7 +88,7 @@ class ModuleMsgId } // Otherwise, we can just create a new message identifier. - tags_out.insert(std::make_pair("msgid", ClientProtocol::MessageTagData(&tag, generator.GetNext()))); + tags_out.emplace("msgid", ClientProtocol::MessageTagData(&tag, generator.GetNext())); return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_ircv3_servertime.cpp b/src/modules/m_ircv3_servertime.cpp index 17aa90dc9..568842cff 100644 --- a/src/modules/m_ircv3_servertime.cpp +++ b/src/modules/m_ircv3_servertime.cpp @@ -66,7 +66,7 @@ class ServerTimeTag { // Server protocol. RefreshTimeString(); - tags.insert(std::make_pair(tagname, ClientProtocol::MessageTagData(this, lasttimestring))); + tags.emplace(tagname, ClientProtocol::MessageTagData(this, lasttimestring)); } }; diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp index d65b1b5e0..d1b10d5f3 100644 --- a/src/modules/m_monitor.cpp +++ b/src/modules/m_monitor.cpp @@ -200,7 +200,7 @@ class IRCv3::Monitor::Manager Entry* AddWatcher(const std::string& nick, LocalUser* user) { - std::pair ret = nicks.insert(std::make_pair(nick, Entry())); + std::pair ret = nicks.emplace(nick, Entry()); Entry& entry = ret.first->second; if (ret.second) entry.SetNick(nick); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index fa312d192..4941c1094 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -238,7 +238,7 @@ class SilenceExtItem : public SimpleExtItem } // Store the silence entry. - list->insert(SilenceEntry(flags, mask)); + list->emplace(flags, mask); } // The value was well formed. @@ -293,7 +293,7 @@ class CommandSilence : public SplitCommand ext.Set(user, list); } - if (!list->insert(SilenceEntry(flags, mask)).second) + if (!list->emplace(flags, mask).second) { user->WriteNumeric(ERR_SILENCE, mask, SilenceEntry::BitsToFlags(flags), "The SILENCE entry you specified already exists"); return CmdResult::FAILURE; diff --git a/src/modules/m_spanningtree/servercommand.cpp b/src/modules/m_spanningtree/servercommand.cpp index 5473ef077..db12ea297 100644 --- a/src/modules/m_spanningtree/servercommand.cpp +++ b/src/modules/m_spanningtree/servercommand.cpp @@ -57,5 +57,5 @@ ServerCommand* ServerCommandManager::GetHandler(const std::string& command) cons bool ServerCommandManager::AddCommand(ServerCommand* cmd) { - return commands.insert(std::make_pair(cmd->name, cmd)).second; + return commands.emplace(cmd->name, cmd).second; } diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 06405d499..8a9986153 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -297,7 +297,7 @@ void TreeSocket::ProcessTag(User* source, const std::string& tag, ClientProtocol ClientProtocol::MessageTagProvider* const tagprov = static_cast(*i); const ModResult res = tagprov->OnProcessTag(source, tagkey, tagval); if (res == MOD_RES_ALLOW) - tags.insert(std::make_pair(tagkey, ClientProtocol::MessageTagData(tagprov, tagval))); + tags.emplace(tagkey, ClientProtocol::MessageTagData(tagprov, tagval)); else if (res == MOD_RES_DENY) break; } diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index d14d3cf41..abb16d16b 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -116,7 +116,7 @@ class ModuleVHost : public Module } CustomVhost vhost(username, pass, hash, mask); - newhosts.insert(std::make_pair(username, vhost)); + newhosts.emplace(username, vhost); } cmd.vhosts.swap(newhosts); -- cgit v1.3.1-10-gc9f91