diff options
| author | 2021-04-06 20:06:18 +0100 | |
|---|---|---|
| committer | 2021-04-07 10:36:11 +0100 | |
| commit | 942fd2bcfd384a12c900999fe663202c87319a68 (patch) | |
| tree | c2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_abbreviation.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_abbreviation.cpp')
| -rw-r--r-- | src/modules/m_abbreviation.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 4d040e320..4580ec645 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -52,10 +52,9 @@ class ModuleAbbreviation : public Module size_t clen = command.length() - 1; std::string foundcommand, matchlist; bool foundmatch = false; - const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands(); - for (CommandParser::CommandMap::const_iterator n = commands.begin(); n != commands.end(); ++n) + for (const auto& [cmdname, _] : ServerInstance->Parser.GetCommands()) { - if (!command.compare(0, clen, n->first, 0, clen)) + if (!command.compare(0, clen, cmdname, 0, clen)) { if (matchlist.length() > 450) { @@ -66,11 +65,11 @@ class ModuleAbbreviation : public Module if (!foundmatch) { /* Found the command */ - foundcommand = n->first; + foundcommand = cmdname; foundmatch = true; } else - matchlist.append(" ").append(n->first); + matchlist.append(" ").append(cmdname); } } |
