mirror of
https://github.com/anope/anope.git
synced 2026-06-30 22:46:40 +02:00
Replace all uses of push_back with emplace_back.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
+2
-2
@@ -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))
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user