summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-06-05 23:11:50 +0200
committerattilamolnar <attilamolnar@hush.com>2013-06-05 23:11:50 +0200
commitd87bfc277858543ff14cd43f4222c66362464094 (patch)
treeecc4252e97d07bdf935b9af751087d5b6abc435c /src/modules
parentf4d8359382153309e67a6b344ae503c321653c81 (diff)
Remove unnecessary string copies and dead code
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_mysql.cpp1
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_dccallow.cpp2
-rw-r--r--src/modules/m_passforward.cpp2
-rw-r--r--src/modules/m_rline.cpp5
-rw-r--r--src/modules/m_sasl.cpp4
-rw-r--r--src/modules/m_shun.cpp4
-rw-r--r--src/modules/m_spanningtree/main.cpp3
-rw-r--r--src/modules/m_spanningtree/utils.cpp18
-rw-r--r--src/modules/m_spanningtree/utils.h15
-rw-r--r--src/modules/m_svshold.cpp2
11 files changed, 15 insertions, 43 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index b2bb44408..22cf5f3f4 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -180,7 +180,6 @@ class MySQLresult : public SQLResult
rows++;
}
mysql_free_result(res);
- res = NULL;
}
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index c779f02df..fb78e41b2 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -32,7 +32,7 @@ class CBan : public XLine
public:
irc::string matchtext;
- CBan(time_t s_time, long d, std::string src, std::string re, std::string ch)
+ CBan(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& ch)
: XLine(s_time, d, src, re, "CBAN")
{
this->matchtext = ch.c_str();
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 712dd91b8..de7b6b7bf 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -166,7 +166,7 @@ class CommandDccallow : public Command
length = ServerInstance->Duration(parameters[1]);
}
- if (!ServerInstance->IsValidMask(mask.c_str()))
+ if (!ServerInstance->IsValidMask(mask))
{
return CMD_FAILURE;
}
diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp
index 84389fb22..c04b306b1 100644
--- a/src/modules/m_passforward.cpp
+++ b/src/modules/m_passforward.cpp
@@ -91,7 +91,7 @@ class ModulePassForward : public Module
if (!nickrequired.empty())
{
/* Check if nick exists and its server is ulined */
- User* u = ServerInstance->FindNick(nickrequired.c_str());
+ User* u = ServerInstance->FindNick(nickrequired);
if (!u || !ServerInstance->ULine(u->server))
return;
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 160092a63..d1ab5d9ba 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -41,11 +41,10 @@ class RLine : public XLine
* @param regex Pattern to match with
* @
*/
- RLine(time_t s_time, long d, std::string src, std::string re, std::string regexs, dynamic_reference<RegexFactory>& rxfactory)
+ RLine(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& regexs, dynamic_reference<RegexFactory>& rxfactory)
: XLine(s_time, d, src, re, "R")
+ , matchtext(regexs)
{
- matchtext = regexs;
-
/* This can throw on failure, but if it does we DONT catch it here, we catch it and display it
* where the object is created, we might not ALWAYS want it to output stuff to snomask x all the time
*/
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index f8d8c5322..b67111987 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -52,7 +52,7 @@ class SaslAuthenticator
bool state_announced;
public:
- SaslAuthenticator(User *user_, std::string method, Module *ctor)
+ SaslAuthenticator(User* user_, const std::string& method)
: user(user_), state(SASL_INIT), state_announced(false)
{
parameterlist params;
@@ -195,7 +195,7 @@ class CommandAuthenticate : public Command
SaslAuthenticator *sasl = authExt.get(user);
if (!sasl)
- authExt.set(user, new SaslAuthenticator(user, parameters[0], creator));
+ authExt.set(user, new SaslAuthenticator(user, parameters[0]));
else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod
{
sasl->AnnounceState();
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 21959e400..8bf4d30e7 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -30,10 +30,10 @@ class Shun : public XLine
public:
std::string matchtext;
- Shun(time_t s_time, long d, std::string src, std::string re, std::string shunmask)
+ Shun(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& shunmask)
: XLine(s_time, d, src, re, "SHUN")
+ , matchtext(shunmask)
{
- this->matchtext = shunmask;
}
~Shun()
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 7e6ad12f8..7c93e7d45 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -271,8 +271,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
return;
}
- QueryType start_type = DNS_QUERY_A;
- start_type = DNS_QUERY_AAAA;
+ QueryType start_type = DNS_QUERY_AAAA;
if (strchr(x->IPAddr.c_str(),':'))
{
in6_addr n;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index cc1c400db..1879d7111 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -202,7 +202,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerLis
return;
}
-bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, std::string omit)
+bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, const std::string& omit)
{
TreeServer* omitroute = this->BestRouteTo(omit);
std::string FullLine = ":" + prefix + " " + command;
@@ -251,21 +251,7 @@ bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::st
return true;
}
-bool SpanningTreeUtilities::DoOneToMany(const char* prefix, const char* command, const parameterlist &params)
-{
- std::string spfx = prefix;
- std::string scmd = command;
- return this->DoOneToMany(spfx, scmd, params);
-}
-
-bool SpanningTreeUtilities::DoOneToAllButSender(const char* prefix, const char* command, const parameterlist &params, std::string omit)
-{
- std::string spfx = prefix;
- std::string scmd = command;
- return this->DoOneToAllButSender(spfx, scmd, params, omit);
-}
-
-bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, std::string target)
+bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, const std::string& target)
{
TreeServer* Route = this->BestRouteTo(target);
if (Route)
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 7d5ffa216..92a03428f 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -88,9 +88,6 @@ class SpanningTreeUtilities : public classbase
/** Hash of currently known server ids
*/
server_hash sidlist;
- /** Hash of servers currently bursting but not initialized as connected
- */
- std::map<irc::string,TreeSocket*> burstingserverlist;
/** List of all outgoing sockets and their timeouts
*/
std::map<TreeSocket*, std::pair<std::string, int> > timeoutlist;
@@ -129,24 +126,16 @@ class SpanningTreeUtilities : public classbase
/** Send a message from this server to one other local or remote
*/
- bool DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, std::string target);
-
- /** Send a message from this server to all but one other, local or remote
- */
- bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, std::string omit);
+ bool DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, const std::string& target);
/** Send a message from this server to all but one other, local or remote
*/
- bool DoOneToAllButSender(const char* prefix, const char* command, const parameterlist &params, std::string omit);
+ bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, const std::string& omit);
/** Send a message from this server to all others
*/
bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params);
- /** Send a message from this server to all others
- */
- bool DoOneToMany(const char* prefix, const char* command, const parameterlist &params);
-
/** Read the spanningtree module's tags from the config file
*/
void ReadConfiguration();
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index d2269839d..d8176043e 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -32,7 +32,7 @@ class SVSHold : public XLine
public:
irc::string nickname;
- SVSHold(time_t s_time, long d, std::string src, std::string re, std::string nick)
+ SVSHold(time_t s_time, long d, const std::string& src, const std::string& re, const std::string& nick)
: XLine(s_time, d, src, re, "SVSHOLD")
{
this->nickname = nick.c_str();