diff options
| author | 2021-03-30 19:44:07 +0100 | |
|---|---|---|
| committer | 2021-03-30 19:44:07 +0100 | |
| commit | 49339528112c57de5e52f2e8bbea91bf37c3704a (patch) | |
| tree | 6e8088af58b4df52958e8a691a6d36386d09df66 /src/modules | |
| parent | Fix the setter and set time of list modes being lost on netburst. (diff) | |
Use emplace_back where possible.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/extra/m_mysql.cpp | 8 | ||||
| -rw-r--r-- | src/modules/extra/m_pgsql.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_banredirect.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_cap.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_cgiirc.cpp | 4 | ||||
| -rw-r--r-- | src/modules/m_chanhistory.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_cloaking.cpp | 4 | ||||
| -rw-r--r-- | src/modules/m_dccallow.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_denychans.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_filter.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_hidemode.cpp | 4 | ||||
| -rw-r--r-- | src/modules/m_hostchange.cpp | 6 | ||||
| -rw-r--r-- | src/modules/m_httpd_acl.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_kicknorejoin.cpp | 2 |
14 files changed, 22 insertions, 22 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index bbd2d7f89..fb74245b8 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -196,9 +196,9 @@ class MySQLresult : public SQL::Result { std::string a = (fields[field_count].name ? fields[field_count].name : ""); if (row[field_count]) - fieldlists[n].push_back(SQL::Field(row[field_count])); + fieldlists[n].emplace_back(row[field_count]); else - fieldlists[n].push_back(SQL::Field()); + fieldlists[n].emplace_back(); colnames.push_back(a); field_count++; } @@ -390,7 +390,7 @@ class SQLConnection : public SQL::Provider { ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Executing MySQL query: " + qs); Parent()->Dispatcher->LockQueue(); - Parent()->qq.push_back(QueryQueueItem(q, qs, this)); + Parent()->qq.emplace_back(q, qs, this); Parent()->Dispatcher->UnlockQueueWakeup(); } @@ -563,7 +563,7 @@ void DispatcherThread::OnStart() if (!Parent->qq.empty() && Parent->qq.front().query == i.query) { Parent->qq.pop_front(); - Parent->rq.push_back(ResultQueueItem(i.query, res)); + Parent->rq.emplace_back(i.query, res); NotifyParent(); } else diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 39a591bec..0722ad9ae 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -423,7 +423,7 @@ restart: else { // wait your turn. - queue.push_back(QueueItem(req,q)); + queue.emplace_back(req, q); } } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 9f6056363..9e1093185 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -206,7 +206,7 @@ class BanRedirect : public ModeWatcher } /* Here 'param' doesn't have the channel on it yet */ - redirects->push_back(BanRedirectEntry(mask[CHAN], change.param)); + redirects->emplace_back(mask[CHAN], change.param); /* Now it does */ change.param.append(mask[CHAN]); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 108beac16..e368145b8 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -104,7 +104,7 @@ class Cap::ManagerImpl : public Cap::Manager, public ReloadModule::EventListener continue; ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Module being reloaded implements cap %s, saving cap users", cap->GetName().c_str()); - capmoddata->caps.push_back(CapModData::Data(cap)); + capmoddata->caps.emplace_back(cap); CapModData::Data& capdata = capmoddata->caps.back(); // Populate list with uuids of users who are using the cap diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index ad4eb8d4d..494743cd5 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -355,7 +355,7 @@ class ModuleCgiIRC { // The IP address should be looked up from the hex IP address. const std::string newident = tag->getString("newident", "gateway", ServerInstance->IsIdent); - identhosts.push_back(IdentHost(masks, newident)); + identhosts.emplace_back(masks, newident); } else if (stdalgo::string::equalsci(type, "webirc")) { @@ -374,7 +374,7 @@ class ModuleCgiIRC tag->source.str().c_str()); } - webirchosts.push_back(WebIRCHost(masks, fingerprint, password, passwordhash)); + webirchosts.emplace_back(masks, fingerprint, password, passwordhash); } else { diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index d7aa293e5..29705e255 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -222,7 +222,7 @@ class ModuleChanHistory if (!list) return; - list->lines.push_back(HistoryItem(user, details)); + list->lines.emplace_back(user, details); if (list->lines.size() > list->maxlen) list->lines.pop_front(); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index cf4c4ddb1..351339789 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -464,10 +464,10 @@ class ModuleCloaking : public Module if (stdalgo::string::equalsci(mode, "half")) { unsigned int domainparts = tag->getUInt("domainparts", 3, 1, 10); - newcloaks.push_back(CloakInfo(MODE_HALF_CLOAK, key, prefix, suffix, ignorecase, domainparts)); + newcloaks.emplace_back(MODE_HALF_CLOAK, key, prefix, suffix, ignorecase, domainparts); } else if (stdalgo::string::equalsci(mode, "full")) - newcloaks.push_back(CloakInfo(MODE_OPAQUE, key, prefix, suffix, ignorecase)); + newcloaks.emplace_back(MODE_OPAQUE, key, prefix, suffix, ignorecase); else throw ModuleException(mode + " is an invalid value for <cloak:mode>; acceptable values are 'half' and 'full', at " + tag->source.str()); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 4c09063b6..e20bc3914 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -308,7 +308,7 @@ class CommandDccallow : public Command return CmdResult::FAILURE; } - dl->push_back(DCCAllow(target->nick, mask, ServerInstance->Time(), length)); + dl->emplace_back(target->nick, mask, ServerInstance->Time(), length); if (length > 0) { diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 7806d39a3..76d34539d 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -106,7 +106,7 @@ class ModuleDenyChannels : public Module // finished parsing all of the badchans. } - badchans.push_back(BadChannel(name, redirect, reason, tag->getBool("allowopers"))); + badchans.emplace_back(name, redirect, reason, tag->getBool("allowopers")); } // Now we have all of the badchan information recorded we can check that all redirect diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index fedd788c5..a1b6977e6 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -798,7 +798,7 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform try { - filters.push_back(FilterResult(RegexEngine, freeform, reason, type, duration, flgs, config)); + filters.emplace_back(RegexEngine, freeform, reason, type, duration, flgs, config); dirty = true; } catch (ModuleException &e) diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index 58e6fa655..f4cd515d3 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -102,7 +102,7 @@ class ModeHook : public ClientProtocol::EventHook { // Create new mode change list or reuse the last one if it's empty if ((modechangelists.empty()) || (!modechangelists.back().empty())) - modechangelists.push_back(Modes::ChangeList()); + modechangelists.emplace_back(); // Add all modes to it which we've accepted so far modechangelists.back().push(mode.GetChangeList().getlist().begin(), i); @@ -160,7 +160,7 @@ class ModeHook : public ClientProtocol::EventHook { // This rank can see some of the mode changes in the filtered mode change list. // Create and store a new protocol message from it. - filteredmsgplists.push_back(ClientProtocol::MessageList()); + filteredmsgplists.emplace_back(); ClientProtocol::Events::Mode::BuildMessages(mode.GetMessages().front().GetSourceUser(), chan, NULL, *filteredchangelist, filteredmodelist, filteredmsgplists.back()); finalmsgplist = &filteredmsgplists.back(); } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index e739dd17a..4e628e638 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -154,12 +154,12 @@ private: if (stdalgo::string::equalsci(action, "addaccount")) { // The hostname is in the format [prefix]<account>[suffix]. - rules.push_back(HostRule(HostRule::HCA_ADDACCOUNT, mask, ports, tag->getString("prefix"), tag->getString("suffix"))); + rules.emplace_back(HostRule::HCA_ADDACCOUNT, mask, ports, tag->getString("prefix"), tag->getString("suffix")); } else if (stdalgo::string::equalsci(action, "addnick")) { // The hostname is in the format [prefix]<nick>[suffix]. - rules.push_back(HostRule(HostRule::HCA_ADDNICK, mask, ports, tag->getString("prefix"), tag->getString("suffix"))); + rules.emplace_back(HostRule::HCA_ADDNICK, mask, ports, tag->getString("prefix"), tag->getString("suffix")); } else if (stdalgo::string::equalsci(action, "set")) { @@ -169,7 +169,7 @@ private: throw ModuleException("<hostchange:value> is a mandatory field when using the 'set' action, at " + tag->source.str()); // The hostname is in the format <value>. - rules.push_back(HostRule(mask, value, ports)); + rules.emplace_back(mask, value, ports); continue; } else diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index dcf8bda1d..4ba3622c7 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -93,7 +93,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Read ACL: path=%s pass=%s whitelist=%s blacklist=%s", path.c_str(), password.c_str(), whitelist.c_str(), blacklist.c_str()); - new_acls.push_back(HTTPACL(path, username, password, whitelist, blacklist)); + new_acls.emplace_back(path, username, password, whitelist, blacklist); } acl_list.swap(new_acls); } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 798b2e92e..8b194b8e1 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -86,7 +86,7 @@ class KickRejoinData // One user can be in the list multiple times if the user gets kicked, force joins // (skipping OnUserPreJoin) and gets kicked again, but that's okay because canjoin() // works correctly in this case as well - kicked.push_back(KickedUser(user, delay)); + kicked.emplace_back(user, delay); } }; |
