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_sethost.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_sethost.cpp')
| -rw-r--r-- | src/modules/m_sethost.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index af87b58ba..239f95b8b 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -48,9 +48,9 @@ class CommandSethost : public Command return CmdResult::FAILURE; } - for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++) + for (const auto& chr : parameters[0]) { - if (!hostmap.test(static_cast<unsigned char>(*x))) + if (!hostmap.test(static_cast<unsigned char>(chr))) { user->WriteNotice("*** SETHOST: Invalid characters in hostname"); return CmdResult::FAILURE; @@ -86,8 +86,8 @@ class ModuleSetHost : public Module const std::string hmap = tag->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789", 1); cmd.hostmap.reset(); - for (std::string::const_iterator n = hmap.begin(); n != hmap.end(); n++) - cmd.hostmap.set(static_cast<unsigned char>(*n)); + for (const auto& chr : hmap) + cmd.hostmap.set(static_cast<unsigned char>(chr)); } }; |
