From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/modules/m_abbreviation.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/modules/m_abbreviation.cpp') 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); } } -- cgit v1.3.1-10-gc9f91