diff --git a/include/command_parse.h b/include/command_parse.h index 7b1e9568d..edc0b5b75 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -182,9 +182,8 @@ class CoreExport CommandParser : public classbase /** Remove all commands relating to module 'source'. * @param source A module name which has introduced new commands - * @return True This function returns true if commands were removed */ - bool RemoveCommands(const char* source); + void RemoveCommands(const char* source); /** Add a new command to the commands hash * @param f The new command_t to add to the list diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 587133975..7a5df7d09 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -379,21 +379,13 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) } } -bool CommandParser::RemoveCommands(const char* source) +void CommandParser::RemoveCommands(const char* source) { command_table::iterator i,safei; - for (i = cmdlist.begin(); i != cmdlist.end(); i++) + for (i = cmdlist.begin(); i != cmdlist.end();) { safei = i; - safei++; - if (safei != cmdlist.end()) - { - RemoveCommand(safei, source); - } - } - safei = cmdlist.begin(); - if (safei != cmdlist.end()) - { + i++; RemoveCommand(safei, source); } return true;