summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-16 20:33:46 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-16 20:33:46 +0200
commit0a8b0d317ed4adc43185c1b791bcf752115dc58e (patch)
treec2be0ec5f20ec5bdb0c8c435fe5bd57d53caeaef /src
parent7fb10c11e442135988d9ea0646f6f2b4a5e421f7 (diff)
Remove unused variables, avoid copies where possible, check empty() instead of size() == 0
Most of these were detected by cppcheck
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp1
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_kicknorejoin.cpp2
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp1
-rw-r--r--src/modules/m_sqloper.cpp2
-rw-r--r--src/modules/u_listmode.h4
9 files changed, 7 insertions, 11 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 3502abe12..4f63654a5 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -673,7 +673,6 @@ void Channel::WriteAllExcept(User* user, bool serversource, char status, CUList
char tb[MAXBUF];
snprintf(tb,MAXBUF,":%s %s", serversource ? ServerInstance->Config->ServerName.c_str() : user->GetFullHost().c_str(), text.c_str());
- std::string out = tb;
this->RawWriteAllExcept(user, serversource, status, except_list, std::string(tb));
}
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 0bf8e0e0a..b05b34c9b 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -389,7 +389,6 @@ bool CommandParser::AddCommand(Command *f)
CommandParser::CommandParser()
{
- para.resize(128);
}
int CommandParser::TranslateUIDs(const std::vector<TranslateType> to, const std::vector<std::string> &source, std::string &dest, bool prefix_final, Command* custom_translator)
@@ -451,7 +450,6 @@ int CommandParser::TranslateUIDs(const std::vector<TranslateType> to, const std:
int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, std::string &dest)
{
User* user = NULL;
- std::string item;
int translations = 0;
dest.clear();
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 97b1612af..25f071bab 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -251,7 +251,7 @@ class ModuleAlias : public Module
}
- int DoAlias(User *user, Channel *c, Alias *a, const std::string compare, const std::string safe)
+ int DoAlias(User *user, Channel *c, Alias *a, const std::string& compare, const std::string& safe)
{
User *u = NULL;
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 5e1b4d38d..4090f5600 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -60,7 +60,7 @@ class FilterResult
bool flag_notice;
bool flag_strip_color;
- FilterResult(const std::string free, const std::string &rea, FilterAction act, long gt, const std::string &fla) :
+ FilterResult(const std::string& free, const std::string& rea, FilterAction act, long gt, const std::string& fla) :
freeform(free), reason(rea), action(act), gline_time(gt)
{
this->FillFlags(fla);
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index c754aa0f0..a914f3869 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -124,7 +124,7 @@ public:
}
}
- if (!dl->size())
+ if (dl->empty())
kr.ext.unset(chan);
}
}
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index b6e6b893b..25937cd6e 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -51,7 +51,7 @@ class OperPrefixMode : public ModeHandler
return MODEACTION_ALLOW;
else
{
- if (source && channel)
+ if (channel)
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only servers are permitted to change channel mode '%c'", source->nick.c_str(), channel->name.c_str(), 'y');
return MODEACTION_DENY;
}
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 5248ea897..d508c092d 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -240,7 +240,6 @@ void TreeSocket::SendChannelModes()
void TreeSocket::SendUsers()
{
char data[MAXBUF];
- std::string dataline;
for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++)
{
if (u->second->registered == REG_ALL)
diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp
index 03b626963..ae581cc4b 100644
--- a/src/modules/m_sqloper.cpp
+++ b/src/modules/m_sqloper.cpp
@@ -119,7 +119,7 @@ class OpMeQuery : public SQLQuery
hostname.append("@").append(user->host);
- if (OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str()))
+ if (OneOfMatches(hostname.c_str(), user->GetIPString(), pattern))
{
/* Opertype and host match, looks like this is it. */
diff --git a/src/modules/u_listmode.h b/src/modules/u_listmode.h
index b370c86e8..0f5903e53 100644
--- a/src/modules/u_listmode.h
+++ b/src/modules/u_listmode.h
@@ -201,7 +201,7 @@ class ListModeBase : public ModeHandler
if (limit.mask.size() && limit.limit > 0)
chanlimits.push_back(limit);
}
- if (chanlimits.size() == 0)
+ if (chanlimits.empty())
{
ListLimit limit;
limit.mask = "*";
@@ -316,7 +316,7 @@ class ListModeBase : public ModeHandler
if (parameter == it->mask)
{
el->erase(it);
- if (el->size() == 0)
+ if (el->empty())
{
extItem.unset(channel);
}