]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove unused variables, avoid copies where possible, check empty() instead of size...
authorattilamolnar <attilamolnar@hush.com>
Thu, 16 May 2013 18:33:46 +0000 (20:33 +0200)
committerattilamolnar <attilamolnar@hush.com>
Thu, 16 May 2013 18:33:46 +0000 (20:33 +0200)
Most of these were detected by cppcheck

include/command_parse.h
include/modules.h
src/channels.cpp
src/command_parse.cpp
src/modules/m_alias.cpp
src/modules/m_filter.cpp
src/modules/m_kicknorejoin.cpp
src/modules/m_operprefix.cpp
src/modules/m_spanningtree/netburst.cpp
src/modules/m_sqloper.cpp
src/modules/u_listmode.h

index f6ff588e1a82139742fd29997a99b8254e99a871..f9e3a740c3012bc3e955f2b6da841600707cdde7 100644 (file)
 #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*
         */
index 8aedaabdd123cd5858989f7c9e028fcba0a400ed..00f2cbb62f45cff1b4e4fd259ff2be2af938d2d6 100644 (file)
@@ -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
index 3502abe1277ad6546d19647b84f2c175fbe99c66..4f63654a57eea9f9555e44554fa26c8c553a9348 100644 (file)
@@ -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));
 }
index 0bf8e0e0a9f1a0b56ef7e489811aeb515f614e30..b05b34c9b5c49b756585748de05bc3431606d292 100644 (file)
@@ -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();
 
index 97b1612afe308d8e4d955d97e739ce38e0ca5cc0..25f071bab3ded04560ae8f7e73f7afc42991d38b 100644 (file)
@@ -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;
 
index 5e1b4d38d69f2fa178ea1869c63a790a36e079f1..4090f5600b4d1a9381cfd0b67c6a9106a1b7b8fd 100644 (file)
@@ -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);
index c754aa0f09e967c6c4eff50a81d95190b4d004b3..a914f38693108b69d37a357d7131a92d72c6d43c 100644 (file)
@@ -124,7 +124,7 @@ public:
                                        }
                                }
 
-                               if (!dl->size())
+                               if (dl->empty())
                                        kr.ext.unset(chan);
                        }
                }
index b6e6b893b73481ee801cdb741fccb3f848b881a9..25937cd6ea27cbc91b8c0dff4ac6e26bf7df9867 100644 (file)
@@ -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;
                        }
index 5248ea897e3a33dcc4ba5f4be58ba062cd2d2d68..d508c092dd00fea08c6fb87a365fb8b64e6da736 100644 (file)
@@ -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)
index 03b6269630c04833431bd514c07cd328904c50b4..ae581cc4b61e3b36a98962291c41243545ff77f9 100644 (file)
@@ -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. */
 
index b370c86e864d4ea513820556e0b7867968b9825d..0f5903e53acc3543ffc185d2a247146254ade24d 100644 (file)
@@ -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);
                                                }