aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_alias.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-04-12 18:22:44 -0500
committerGravatar Daniel De Graaf2010-08-03 17:32:42 -0400
commitc120a4e37f8d13f0e2540e2534bd7cc36e1f1950 (patch)
treea0415046bbde3c687bf87c2b48b9963bdf9861ab /src/modules/m_alias.cpp
parentRemove unneeded copy of server name for every remote user (diff)
Make irc::string faster and less wasteful
Change irc::string from an std::basic_string typedef to a wrapper around an std::string, to avoid unneeded copies in assign().
Diffstat (limited to 'src/modules/m_alias.cpp')
-rw-r--r--src/modules/m_alias.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index c7f0da690..fdd237474 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -200,21 +200,22 @@ class ModuleAlias : public Module
// text is like "!moo cows bite me", we want "!moo" first
irc::spacesepstream ss(text);
ss.GetToken(scommand);
- irc::string fcommand = scommand.c_str();
- if (fcommand.empty())
+ if (scommand.empty())
{
return; // wtfbbq
}
// we don't want to touch non-fantasy stuff
- if (*fcommand.c_str() != fprefix)
+ if (*scommand.c_str() != fprefix)
{
return;
}
// nor do we give a shit about the prefix
- fcommand.erase(fcommand.begin());
+ scommand.erase(scommand.begin());
+
+ irc::string fcommand = scommand;
std::multimap<irc::string, Alias>::iterator i = Aliases.find(fcommand);
@@ -226,7 +227,7 @@ class ModuleAlias : public Module
/* The parameters for the command in their original form, with the command stripped off */
- std::string compare = text.substr(fcommand.length() + 1);
+ std::string compare = text.substr(scommand.length() + 1);
while (*(compare.c_str()) == ' ')
compare.erase(compare.begin());