diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-05-16 20:33:46 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-05-16 20:33:46 +0200 |
commit | 0a8b0d317ed4adc43185c1b791bcf752115dc58e (patch) | |
tree | c2be0ec5f20ec5bdb0c8c435fe5bd57d53caeaef | |
parent | 7fb10c11e442135988d9ea0646f6f2b4a5e421f7 (diff) |
Remove unused variables, avoid copies where possible, check empty() instead of size() == 0
Most of these were detected by cppcheck
-rw-r--r-- | include/command_parse.h | 10 | ||||
-rw-r--r-- | include/modules.h | 2 | ||||
-rw-r--r-- | src/channels.cpp | 1 | ||||
-rw-r--r-- | src/command_parse.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_alias.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_kicknorejoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operprefix.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_sqloper.cpp | 2 | ||||
-rw-r--r-- | src/modules/u_listmode.h | 4 |
11 files changed, 8 insertions, 22 deletions
diff --git a/include/command_parse.h b/include/command_parse.h index f6ff588e1..f9e3a740c 100644 --- a/include/command_parse.h +++ b/include/command_parse.h @@ -23,10 +23,6 @@ #ifndef COMMAND_PARSE_H #define COMMAND_PARSE_H -/** A list of dll/so files containing the command handlers for the core - */ -typedef std::map<std::string, void*> SharedObjectList; - /** This class handles command management and parsing. * It allows you to add and remove commands from the map, * call command handlers by name, and chop up comma seperated @@ -35,10 +31,6 @@ typedef std::map<std::string, void*> SharedObjectList; class CoreExport CommandParser { private: - /** Parameter buffer - */ - std::vector<std::string> para; - /** Process a parameter string into a list of items * @param command_p The output list of items * @param parameters The input string @@ -52,8 +44,6 @@ class CoreExport CommandParser */ bool ProcessCommand(LocalUser *user, std::string &cmd); - - public: /** Command list, a hash_map of command names to Command* */ diff --git a/include/modules.h b/include/modules.h index 8aedaabdd..00f2cbb62 100644 --- a/include/modules.h +++ b/include/modules.h @@ -116,7 +116,7 @@ struct ModResult { * and numerical comparisons in preprocessor macros if they wish to support * multiple versions of InspIRCd in one file. */ -#define INSPIRCD_VERSION_API 5 +#define INSPIRCD_VERSION_API 6 /** * This #define allows us to call a method in all 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); } |