diff options
author | Peter Powell <petpow@saberuk.com> | 2017-08-13 08:32:09 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-08-16 17:21:16 +0100 |
commit | 3fbc05242c87fee6a401b94877f7eda865d672bc (patch) | |
tree | db9d7c6e5946487610ef47ccba1ca97522036215 | |
parent | 0d2430cc5fb0d5d53d68fc09570cb7231c4e7c65 (diff) |
m_sethost: use length() instead of counting in the loop.
-rw-r--r-- | src/modules/m_sethost.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 75dbe1c6a..a5f36da65 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -36,8 +36,7 @@ class CommandSethost : public Command CmdResult Handle (const std::vector<std::string>& parameters, User *user) { - size_t len = 0; - for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++, len++) + for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++) { if (!hostmap[(const unsigned char)*x]) { @@ -46,7 +45,7 @@ class CommandSethost : public Command } } - if (len > ServerInstance->Config->Limits.MaxHost) + if (parameters[0].length() > ServerInstance->Config->Limits.MaxHost) { user->WriteNotice("*** SETHOST: Host too long"); return CMD_FAILURE; |