aboutsummaryrefslogtreecommitdiff
path: root/src/command_parse.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-07-22 16:18:45 +0100
committerGravatar Sadie Powell2022-07-22 16:18:45 +0100
commit51a2948e7bcad30f1a13892009d587cd7cf3d17c (patch)
tree81e125ad9de32cc845d7b5e750993d477471c110 /src/command_parse.cpp
parentKill a now unused field in the showwhois module. (diff)
Improve the performance of AddCommand slightly.
Diffstat (limited to 'src/command_parse.cpp')
-rw-r--r--src/command_parse.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 2288097d0..c74556ad3 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -359,15 +359,9 @@ void CommandParser::ProcessBuffer(LocalUser* user, const std::string& buffer)
ProcessCommand(user, command, parameters);
}
-bool CommandParser::AddCommand(Command *f)
+bool CommandParser::AddCommand(Command* cmd)
{
- /* create the command and push it onto the table */
- if (cmdlist.find(f->name) == cmdlist.end())
- {
- cmdlist[f->name] = f;
- return true;
- }
- return false;
+ return cmdlist.emplace(cmd->name, cmd).second;
}
std::string CommandParser::TranslateUIDs(const std::vector<TranslateType>& to, const CommandBase::Params& source, bool prefix_final, CommandBase* custom_translator)