diff options
author | Sadie Powell <sadie@witchery.services> | 2022-01-04 12:28:55 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2022-01-04 12:28:55 +0000 |
commit | 106750db77be01c7b2d277a12d9b80de15cb8fbb (patch) | |
tree | 87df7f8b5966ca704f20ee7ab6a79b45ed2e95a2 | |
parent | 7d1047490e4380c4f02900b711c66055d29fb387 (diff) |
Replace all uses of push_back with emplace_back.
-rw-r--r-- | modules/commands/cs_mode.cpp | 8 | ||||
-rw-r--r-- | modules/commands/ms_ignore.cpp | 2 | ||||
-rw-r--r-- | modules/database/db_redis.cpp | 36 | ||||
-rw-r--r-- | modules/m_dns.cpp | 4 | ||||
-rw-r--r-- | modules/m_httpd.cpp | 2 | ||||
-rw-r--r-- | modules/m_redis.cpp | 6 | ||||
-rw-r--r-- | modules/pseudoclients/chanserv.cpp | 8 | ||||
-rw-r--r-- | modules/pseudoclients/nickserv.cpp | 6 | ||||
-rw-r--r-- | modules/webcpanel/pages/chanserv/access.cpp | 8 | ||||
-rw-r--r-- | modules/webcpanel/pages/chanserv/akick.cpp | 4 | ||||
-rw-r--r-- | modules/webcpanel/pages/chanserv/modes.cpp | 4 | ||||
-rw-r--r-- | modules/webcpanel/pages/nickserv/access.cpp | 4 | ||||
-rw-r--r-- | modules/webcpanel/pages/nickserv/cert.cpp | 4 | ||||
-rw-r--r-- | modules/webcpanel/pages/operserv/akill.cpp | 6 | ||||
-rw-r--r-- | modules/webcpanel/template_fileserver.cpp | 2 | ||||
-rw-r--r-- | src/config.cpp | 2 | ||||
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/messages.cpp | 2 | ||||
-rw-r--r-- | src/misc.cpp | 4 |
19 files changed, 57 insertions, 57 deletions
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 17ecc566c..a889ba4ec 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -685,8 +685,8 @@ class CommandCSMode : public Command { std::vector<Anope::string> new_params; new_params.push_back(params[0]); - new_params.push_back("SET"); - new_params.push_back("-*"); + new_params.emplace_back("SET"); + new_params.emplace_back("-*"); this->DoSet(source, ci, new_params); return; } @@ -721,9 +721,9 @@ class CommandCSMode : public Command std::vector<Anope::string> new_params; new_params.push_back(params[0]); - new_params.push_back("SET"); + new_params.emplace_back("SET"); new_params.push_back("-" + stringify(cm->mchar)); - new_params.push_back("*"); + new_params.emplace_back("*"); this->DoSet(source, ci, new_params); } diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp index 8e0f1de9e..4543689b2 100644 --- a/modules/commands/ms_ignore.cpp +++ b/modules/commands/ms_ignore.cpp @@ -58,7 +58,7 @@ class CommandMSIgnore : public Command if (std::find(mi->ignores.begin(), mi->ignores.end(), param.ci_str()) == mi->ignores.end()) { - mi->ignores.push_back(param.ci_str()); + mi->ignores.emplace_back(param.ci_str()); source.Reply(_("\002%s\002 added to ignore list."), param.c_str()); } else diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index bbde70b10..8e0014fd7 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -151,7 +151,7 @@ class DatabaseRedis : public Module, public Pipe obj->UpdateCache(data); std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get object attrs to clear before updating */ @@ -211,7 +211,7 @@ class DatabaseRedis : public Module, public Pipe return; std::vector<Anope::string> args; - args.push_back("SMEMBERS"); + args.emplace_back("SMEMBERS"); args.push_back("ids:" + sb->GetName()); redis->SendCommand(new TypeLoader(this, sb->GetName()), args); @@ -240,7 +240,7 @@ class DatabaseRedis : public Module, public Pipe } std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get all of the attributes for this object */ @@ -284,7 +284,7 @@ void TypeLoader::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + this->type + ":" + stringify(id)); me->redis->SendCommand(new ObjectLoader(me, this->type, id), args); @@ -358,14 +358,14 @@ void Deleter::OnResult(const Reply &r) me->redis->StartTransaction(); std::vector<Anope::string> args; - args.push_back("DEL"); + args.emplace_back("DEL"); args.push_back("hash:" + this->type + ":" + stringify(this->id)); /* Delete hash object */ me->redis->SendCommand(NULL, args); args.clear(); - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("ids:" + this->type); args.push_back(stringify(this->id)); @@ -378,7 +378,7 @@ void Deleter::OnResult(const Reply &r) *value = r.multi_bulk[i + 1]; args.clear(); - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + this->type + ":" + key->bulk + ":" + value->bulk); args.push_back(stringify(this->id)); @@ -421,7 +421,7 @@ void Updater::OnResult(const Reply &r) *value = r.multi_bulk[i + 1]; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + this->type + ":" + key->bulk + ":" + value->bulk); args.push_back(stringify(this->id)); @@ -431,13 +431,13 @@ void Updater::OnResult(const Reply &r) /* Add object id to id set for this type */ std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("ids:" + this->type); args.push_back(stringify(obj->id)); me->redis->SendCommand(NULL, args); args.clear(); - args.push_back("HMSET"); + args.emplace_back("HMSET"); args.push_back("hash:" + this->type + ":" + stringify(obj->id)); typedef std::map<Anope::string, std::stringstream *> items; @@ -447,11 +447,11 @@ void Updater::OnResult(const Reply &r) std::stringstream *value = it->second; args.push_back(key); - args.push_back(value->str()); + args.emplace_back(value->str()); std::vector<Anope::string> args2; - args2.push_back("SADD"); + args2.emplace_back("SADD"); args2.push_back("value:" + this->type + ":" + key + ":" + value->str()); args2.push_back(stringify(obj->id)); @@ -528,7 +528,7 @@ void SubscriptionListener::OnResult(const Reply &r) Log(LOG_DEBUG) << "redis: notify: got modify for object id " << obj_id << " of type " << type; std::vector<Anope::string> args; - args.push_back("HGETALL"); + args.emplace_back("HGETALL"); args.push_back("hash:" + type + ":" + id); me->redis->SendCommand(new ModifiedObject(me, type, obj_id), args); @@ -556,7 +556,7 @@ void SubscriptionListener::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + type + ":" + k + ":" + value->str()); args.push_back(id); @@ -565,7 +565,7 @@ void SubscriptionListener::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("ids:" + type); args.push_back(stringify(s->id)); @@ -609,7 +609,7 @@ void ModifiedObject::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SREM"); + args.emplace_back("SREM"); args.push_back("value:" + st->GetName() + ":" + key + ":" + value->str()); args.push_back(stringify(this->id)); @@ -642,7 +642,7 @@ void ModifiedObject::OnResult(const Reply &r) std::stringstream *value = it->second; std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("value:" + st->GetName() + ":" + key + ":" + value->str()); args.push_back(stringify(obj->id)); @@ -651,7 +651,7 @@ void ModifiedObject::OnResult(const Reply &r) } std::vector<Anope::string> args; - args.push_back("SADD"); + args.emplace_back("SADD"); args.push_back("ids:" + st->GetName()); args.push_back(stringify(obj->id)); diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 8b39b75b8..0800dac01 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -949,7 +949,7 @@ class MyManager : public Manager, public Timer continue; } - packet->questions.push_back(Question(zone, QUERY_SOA)); + packet->questions.emplace_back(zone, QUERY_SOA); new NotifySocket(ip.find(':') != Anope::string::npos, packet); } @@ -1052,7 +1052,7 @@ class ModuleDNS : public Module Anope::string nip = n->Get<Anope::string>("ip"); short nport = n->Get<short>("port"); - notify.push_back(std::make_pair(nip, nport)); + notify.emplace_back(nip, nport); } if (Anope::IsFile(nameserver)) diff --git a/modules/m_httpd.cpp b/modules/m_httpd.cpp index ad2a28b99..56c543e71 100644 --- a/modules/m_httpd.cpp +++ b/modules/m_httpd.cpp @@ -312,7 +312,7 @@ class MyHTTPProvider : public HTTPProvider, public Timer ClientSocket* OnAccept(int fd, const sockaddrs &addr) override { MyHTTPClient *c = new MyHTTPClient(this, fd, addr); - this->clients.push_back(c); + this->clients.emplace_back(c); return c; } diff --git a/modules/m_redis.cpp b/modules/m_redis.cpp index 62c831a44..93f229ad5 100644 --- a/modules/m_redis.cpp +++ b/modules/m_redis.cpp @@ -165,7 +165,7 @@ class MyRedisService : public Provider { std::vector<std::pair<const char *, size_t> > args; for (unsigned j = 0; j < cmds.size(); ++j) - args.push_back(std::make_pair(cmds[j].c_str(), cmds[j].length())); + args.emplace_back(cmds[j].c_str(), cmds[j].length()); this->Send(s, i, args); } @@ -191,7 +191,7 @@ class MyRedisService : public Provider { std::vector<std::pair<const char *, size_t> > args; for (unsigned j = 0; j < cmds.size(); ++j) - args.push_back(std::make_pair(cmds[j].c_str(), cmds[j].length())); + args.emplace_back(cmds[j].c_str(), cmds[j].length()); this->Send(i, args); } @@ -223,7 +223,7 @@ class MyRedisService : public Provider } std::vector<Anope::string> args; - args.push_back("PSUBSCRIBE"); + args.emplace_back("PSUBSCRIBE"); args.push_back(pattern); this->SendCommand(sub, NULL, args); diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index 100b0e50b..2c10dc3dd 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -112,10 +112,10 @@ class ChanServCore : public Module, public ChanServService spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "greet fantasy")).GetTokens(defaults); if (defaults.empty()) { - defaults.push_back("KEEPTOPIC"); - defaults.push_back("CS_SECURE"); - defaults.push_back("SECUREFOUNDER"); - defaults.push_back("SIGNKICK"); + defaults.emplace_back("KEEPTOPIC"); + defaults.emplace_back("CS_SECURE"); + defaults.emplace_back("SECUREFOUNDER"); + defaults.emplace_back("SIGNKICK"); } else if (defaults[0].equals_ci("none")) defaults.clear(); diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp index e09118e58..6095e7477 100644 --- a/modules/pseudoclients/nickserv.cpp +++ b/modules/pseudoclients/nickserv.cpp @@ -295,9 +295,9 @@ class NickServCore : public Module, public NickServService spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "ns_secure memo_signon memo_receive")).GetTokens(defaults); if (defaults.empty()) { - defaults.push_back("NS_SECURE"); - defaults.push_back("MEMO_SIGNON"); - defaults.push_back("MEMO_RECEIVE"); + defaults.emplace_back("NS_SECURE"); + defaults.emplace_back("MEMO_SIGNON"); + defaults.emplace_back("MEMO_RECEIVE"); } else if (defaults[0].equals_ci("none")) defaults.clear(); diff --git a/modules/webcpanel/pages/chanserv/access.cpp b/modules/webcpanel/pages/chanserv/access.cpp index 647009a08..5da811b4b 100644 --- a/modules/webcpanel/pages/chanserv/access.cpp +++ b/modules/webcpanel/pages/chanserv/access.cpp @@ -52,7 +52,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("DEL"); + params.emplace_back("DEL"); params.push_back(message.get_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "ChanServ", "chanserv/access", params, replacements); @@ -65,7 +65,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("ADD"); + params.emplace_back("ADD"); params.push_back(message.post_data["mask"]); params.push_back(message.post_data["access"]); @@ -75,7 +75,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("ADD"); + params.emplace_back("ADD"); params.push_back(message.post_data["mask"]); WebPanel::RunCommandWithName(client, na->nc, "ChanServ", "chanserv/xop", message.post_data["access"], params, replacements); @@ -84,7 +84,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("MODIFY"); + params.emplace_back("MODIFY"); params.push_back(message.post_data["mask"]); params.push_back(message.post_data["access"]); diff --git a/modules/webcpanel/pages/chanserv/akick.cpp b/modules/webcpanel/pages/chanserv/akick.cpp index 6bd31bb4b..fbb2a06c1 100644 --- a/modules/webcpanel/pages/chanserv/akick.cpp +++ b/modules/webcpanel/pages/chanserv/akick.cpp @@ -50,7 +50,7 @@ bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("DEL"); + params.emplace_back("DEL"); params.push_back(message.get_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "ChanServ", "chanserv/akick", params, replacements); @@ -59,7 +59,7 @@ bool WebCPanel::ChanServ::Akick::OnRequest(HTTPProvider *server, const Anope::st { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("ADD"); + params.emplace_back("ADD"); params.push_back(message.post_data["mask"]); if (message.post_data["reason"].empty() == false) params.push_back(message.post_data["reason"]); diff --git a/modules/webcpanel/pages/chanserv/modes.cpp b/modules/webcpanel/pages/chanserv/modes.cpp index d0d86a7a1..ffc6bc9a6 100644 --- a/modules/webcpanel/pages/chanserv/modes.cpp +++ b/modules/webcpanel/pages/chanserv/modes.cpp @@ -79,7 +79,7 @@ bool WebCPanel::ChanServ::Modes::OnRequest(HTTPProvider *server, const Anope::st { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("SET"); + params.emplace_back("SET"); params.push_back("-" + Anope::string(cm->mchar)); params.push_back(message.get_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "ChanServ", "chanserv/mode", params, replacements); @@ -88,7 +88,7 @@ bool WebCPanel::ChanServ::Modes::OnRequest(HTTPProvider *server, const Anope::st { std::vector<Anope::string> params; params.push_back(ci->name); - params.push_back("SET"); + params.emplace_back("SET"); params.push_back("+" + Anope::string(cm->mchar)); params.push_back(message.post_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "ChanServ", "chanserv/mode", params, replacements); diff --git a/modules/webcpanel/pages/nickserv/access.cpp b/modules/webcpanel/pages/nickserv/access.cpp index b6de82940..b35dc4a56 100644 --- a/modules/webcpanel/pages/nickserv/access.cpp +++ b/modules/webcpanel/pages/nickserv/access.cpp @@ -16,7 +16,7 @@ bool WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::s if (message.post_data.count("access") > 0) { std::vector<Anope::string> params; - params.push_back("ADD"); + params.emplace_back("ADD"); params.push_back(message.post_data["access"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "NickServ", "nickserv/access", params, replacements); @@ -24,7 +24,7 @@ bool WebCPanel::NickServ::Access::OnRequest(HTTPProvider *server, const Anope::s else if (message.get_data.count("del") > 0 && message.get_data.count("mask") > 0) { std::vector<Anope::string> params; - params.push_back("DEL"); + params.emplace_back("DEL"); params.push_back(message.get_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "NickServ", "nickserv/access", params, replacements); diff --git a/modules/webcpanel/pages/nickserv/cert.cpp b/modules/webcpanel/pages/nickserv/cert.cpp index a68fe303c..0ab00bc0d 100644 --- a/modules/webcpanel/pages/nickserv/cert.cpp +++ b/modules/webcpanel/pages/nickserv/cert.cpp @@ -17,7 +17,7 @@ bool WebCPanel::NickServ::Cert::OnRequest(HTTPProvider *server, const Anope::str if (message.post_data.count("certfp") > 0) { std::vector<Anope::string> params; - params.push_back("ADD"); + params.emplace_back("ADD"); params.push_back(message.post_data["certfp"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "NickServ", "nickserv/cert", params, replacements); @@ -25,7 +25,7 @@ bool WebCPanel::NickServ::Cert::OnRequest(HTTPProvider *server, const Anope::str else if (message.get_data.count("del") > 0 && message.get_data.count("mask") > 0) { std::vector<Anope::string> params; - params.push_back("DEL"); + params.emplace_back("DEL"); params.push_back(message.get_data["mask"]); WebPanel::RunCommand(client, na->nc->display, na->nc, "NickServ", "nickserv/cert", params, replacements); diff --git a/modules/webcpanel/pages/operserv/akill.cpp b/modules/webcpanel/pages/operserv/akill.cpp index ab9e2adf2..6ef137919 100644 --- a/modules/webcpanel/pages/operserv/akill.cpp +++ b/modules/webcpanel/pages/operserv/akill.cpp @@ -29,18 +29,18 @@ bool WebCPanel::OperServ::Akill::OnRequest(HTTPProvider *server, const Anope::st { std::vector<Anope::string> params; std::stringstream cmdstr; - params.push_back("ADD"); + params.emplace_back("ADD"); cmdstr << "+" << HTTPUtils::URLDecode(message.post_data["expiry"]); cmdstr << " " << HTTPUtils::URLDecode(message.post_data["mask"]); cmdstr << " " << HTTPUtils::URLDecode(message.post_data["reason"]); - params.push_back(cmdstr.str()); + params.emplace_back(cmdstr.str()); WebPanel::RunCommand(client, na->nc->display, na->nc, "OperServ", "operserv/akill", params, replacements); } if (message.get_data["del"] == "1" && message.get_data.count("number") > 0) { std::vector<Anope::string> params; - params.push_back("DEL"); + params.emplace_back("DEL"); params.push_back(HTTPUtils::URLDecode(message.get_data["number"])); WebPanel::RunCommand(client, na->nc->display, na->nc, "OperServ", "operserv/akill", params, replacements); } diff --git a/modules/webcpanel/template_fileserver.cpp b/modules/webcpanel/template_fileserver.cpp index a396d4745..1f61b0bda 100644 --- a/modules/webcpanel/template_fileserver.cpp +++ b/modules/webcpanel/template_fileserver.cpp @@ -186,7 +186,7 @@ void TemplateFileServer::Serve(HTTPProvider *server, const Anope::string &page_n if (temp_variables.size() != real_variables.size()) Log() << "Invalid FOR in web template " << this->file_name << " variable mismatch"; else - ForLoop::Stack.push_back(ForLoop(j + f, r, temp_variables, real_variables)); + ForLoop::Stack.emplace_back(j + f, r, temp_variables, real_variables); } } else if (content == "END FOR") diff --git a/src/config.cpp b/src/config.cpp index f323ae6c7..502cb3bac 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -199,7 +199,7 @@ Conf::Conf() : Block(""), EmptyBlock("") if (password.find(' ') != Anope::string::npos || password[0] == ':') throw ConfigException("uplink:password is not valid"); - this->Uplinks.push_back(Uplink(host, port, password, ipv6)); + this->Uplinks.emplace_back(host, port, password, ipv6); } for (int i = 0; i < this->CountBlock("module"); ++i) diff --git a/src/init.cpp b/src/init.cpp index 42cba3f10..48e3ebbfc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -57,7 +57,7 @@ static void ParseCommandLineArguments(int ac, char **av) if (option.empty()) continue; - CommandLineArguments.push_back(std::make_pair(option, param)); + CommandLineArguments.emplace_back(option, param); } } diff --git a/src/messages.cpp b/src/messages.cpp index 3a5c636c6..c0c41b31b 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -92,7 +92,7 @@ void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms, } std::list<SJoinUser> users; - users.push_back(std::make_pair(ChannelStatus(), user)); + users.emplace_back(ChannelStatus(), user); Channel *chan = Channel::Find(channel); SJoin(source, channel, chan ? chan->creation_time : Anope::CurTime, "", users); diff --git a/src/misc.cpp b/src/misc.cpp index ff1b05b02..11f038710 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -143,7 +143,7 @@ void ListFormatter::Process(std::vector<Anope::string> &buffer) std::set<Anope::string> breaks; for (unsigned i = 0; i < this->columns.size(); ++i) { - tcolumns.push_back(Language::Translate(this->nc, this->columns[i].c_str())); + tcolumns.emplace_back(Language::Translate(this->nc, this->columns[i].c_str())); lengths[this->columns[i]] = tcolumns[i].length(); } for (unsigned i = 0; i < this->entries.size(); ++i) @@ -234,7 +234,7 @@ Anope::string& InfoFormatter::operator[](const Anope::string &key) Anope::string tkey = Language::Translate(this->nc, key.c_str()); if (tkey.length() > this->longest) this->longest = tkey.length(); - this->replies.push_back(std::make_pair(tkey, "")); + this->replies.emplace_back(tkey, ""); return this->replies.back().second; } |