summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-02 16:01:45 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-02 16:01:45 +0000
commit787c16487e8b13ba973501d88fe381d1528e68de (patch)
tree6ca4d9b75713c1856ea9abf31424fc6bc05c6b22 /src/mode.cpp
parent0376f1d8be09a242befe207be4fa9e809d098557 (diff)
Optimize MODE #chan b etc, avoid a 256 byte memset for duplicate mode checks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9601 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 91a64f89b..8712e63b5 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -371,11 +371,10 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo
{
const char* mode = parameters[1];
int nonlistmodes_found = 0;
- bool sent[256];
- mask = MASK_CHANNEL;
+ seq++;
- memset(&sent, 0, 256);
+ mask = MASK_CHANNEL;
while (mode && *mode)
{
@@ -390,9 +389,9 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo
/* Ensure the user doesnt request the same mode twice,
* so they cant flood themselves off out of idiocy.
*/
- if (!sent[mletter])
+ if (sent[mletter] != seq)
{
- sent[mletter] = true;
+ sent[mletter] = seq;
}
else
{
@@ -1199,4 +1198,7 @@ ModeParser::ModeParser(InspIRCd* Instance) : ServerInstance(Instance)
/* Initialise the RFC mode letters */
for (int index = 0; modes[index]; index++)
this->AddMode(modes[index]);
+
+ seq = 0;
+ memset(&sent, 0, 256);
}