diff options
author | Sadie Powell <sadie@witchery.services> | 2023-10-10 21:14:50 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-10-11 15:51:52 +0100 |
commit | a3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch) | |
tree | 82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /modules/commands/os_modinfo.cpp | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'modules/commands/os_modinfo.cpp')
-rw-r--r-- | modules/commands/os_modinfo.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp index 1dfa519ae..5d6de2e6c 100644 --- a/modules/commands/os_modinfo.cpp +++ b/modules/commands/os_modinfo.cpp @@ -34,22 +34,18 @@ class CommandOSModInfo : public Command source.Reply(_(" Loaded at: %p"), m->handle); std::vector<Anope::string> servicekeys = Service::GetServiceKeys("Command"); - for (unsigned i = 0; i < servicekeys.size(); ++i) + for (const auto &servicekey : servicekeys) { - ServiceReference<Command> c("Command", servicekeys[i]); + ServiceReference<Command> c("Command", servicekey); if (!c || c->owner != m) continue; source.Reply(_(" Providing service: \002%s\002"), c->name.c_str()); - for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) + for (const auto &[_, bi] : *BotListByNick) { - const BotInfo *bi = it->second; - - for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit) + for (const auto &[c_name, info] : bi->commands) { - const Anope::string &c_name = cit->first; - const CommandInfo &info = cit->second; if (info.name != c->name) continue; source.Reply(_(" Command \002%s\002 on \002%s\002 is linked to \002%s\002"), c_name.c_str(), bi->nick.c_str(), c->name.c_str()); @@ -116,10 +112,8 @@ class CommandOSModList : public Command source.Reply(_("Current module list:")); int count = 0; - for (std::list<Module *>::iterator it = ModuleManager::Modules.begin(), it_end = ModuleManager::Modules.end(); it != it_end; ++it) + for (auto *m : ModuleManager::Modules) { - Module *m = *it; - bool show = false; Anope::string mtype; |