From 5585654df265bc37d547fa7738e35cc7ae7dacbb Mon Sep 17 00:00:00 2001 From: B00mX0r Date: Tue, 3 Jul 2018 16:07:39 +0100 Subject: Use !empty() instead of 'size() > 0' when checking parameter count. --- src/coremods/core_user/cmd_away.cpp | 2 +- src/modules/m_jumpserver.cpp | 2 +- src/modules/m_silence.cpp | 4 ++-- src/modules/m_spanningtree/away.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coremods/core_user/cmd_away.cpp b/src/coremods/core_user/cmd_away.cpp index fb720a5a7..32d4a9d84 100644 --- a/src/coremods/core_user/cmd_away.cpp +++ b/src/coremods/core_user/cmd_away.cpp @@ -33,7 +33,7 @@ CmdResult CommandAway::Handle (const std::vector& parameters, User { ModResult MOD_RESULT; - if ((parameters.size()) && (!parameters[0].empty())) + if ((!parameters.empty()) && (!parameters[0].empty())) { FIRST_MOD_RESULT(OnSetAway, MOD_RESULT, (user, parameters[0])); diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index f94fc31e6..e54d1efb2 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -58,7 +58,7 @@ class CommandJumpserver : public Command std::string n_done_s; /* No parameters: jumpserver disabled */ - if (!parameters.size()) + if (parameters.empty()) { if (port) user->WriteNotice("*** Disabled jumpserver (previously set to '" + redirect_to + ":" + ConvToStr(port) + "')"); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index cc510c3dd..e60694470 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -123,7 +123,7 @@ class CommandSilence : public Command CmdResult Handle(const std::vector& parameters, User* user) CXX11_OVERRIDE { - if (!parameters.size()) + if (parameters.empty()) { // no parameters, show the current silence list. silencelist* sl = ext.get(user); @@ -140,7 +140,7 @@ class CommandSilence : public Command return CMD_SUCCESS; } - else if (parameters.size() > 0) + else { // one or more parameters, add or delete entry from the list (only the first parameter is used) std::string mask(parameters[0], 1); diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp index 7c514c49e..28cbf8f73 100644 --- a/src/modules/m_spanningtree/away.cpp +++ b/src/modules/m_spanningtree/away.cpp @@ -25,7 +25,7 @@ CmdResult CommandAway::HandleRemote(::RemoteUser* u, std::vector& params) { - if (params.size()) + if (!params.empty()) { FOREACH_MOD(OnSetAway, (u, params.back())); -- cgit v1.2.3