diff --git a/daemon/commands/help.cc b/daemon/commands/help.cc index 6fd2850db..329a96359 100644 --- a/daemon/commands/help.cc +++ b/daemon/commands/help.cc @@ -25,10 +25,6 @@ HelpCommand::HelpCommand() : DaemonCommand("help", "help ", "Show help notice, if command is unspecified or inexistent show all commands.") { } -static bool compareCommand(const DaemonCommand *command1, const DaemonCommand *command2) { - return (command1->getProto() < command2->getProto()); -} - void HelpCommand::exec(Daemon *app, const char *args) { ostringstream ost; list::const_iterator it; @@ -44,9 +40,7 @@ void HelpCommand::exec(Daemon *app, const char *args) { } if (args==NULL){ - list lcopy = l; - lcopy.sort(compareCommand); - for (it = lcopy.begin(); it != lcopy.end(); ++it) { + for (it = l.begin(); it != l.end(); ++it) { ost << (*it)->getProto() << endl; } } diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 82f3fa326..cb4cfa358 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -457,6 +457,10 @@ void Daemon::removeAudioStream(int id) { } } +static bool compareCommands(const DaemonCommand *command1, const DaemonCommand *command2) { + return (command1->getProto() < command2->getProto()); +} + void Daemon::initCommands() { mCommands.push_back(new RegisterCommand()); mCommands.push_back(new ContactCommand()); @@ -503,6 +507,7 @@ void Daemon::initCommands() { mCommands.push_back(new ConfigSetCommand()); mCommands.push_back(new NetsimCommand()); mCommands.push_back(new CNCommand()); + mCommands.sort(compareCommands); } void Daemon::uninitCommands() {