summaryrefslogtreecommitdiff
path: root/src/hashcomp.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:43:25 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:43:25 +0000
commit219993bc9018d9f0d9568330d7a972b68b785d27 (patch)
tree9d827a0e1a2ad343ebff21fb7f692b1fd2835650 /src/hashcomp.cpp
parent2630a87bb13b089e6d0fdcff4bcd0f3a9612e52f (diff)
Replace std::deque with std::vector in spanningtree and related modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11593 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r--src/hashcomp.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 6c0ce82b8..04c24418c 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -343,26 +343,26 @@ void irc::modestacker::PushMinus()
this->Push('-',"");
}
-int irc::modestacker::GetStackedLine(std::deque<std::string> &result, int max_line_size)
+int irc::modestacker::GetStackedLine(std::vector<std::string> &result, int max_line_size)
{
if (sequence.empty())
{
- result.clear();
return 0;
}
- int n = 0;
+ unsigned int n = 0;
int size = 1; /* Account for initial +/- char */
int nextsize = 0;
- result.clear();
- result.push_back(adding ? "+" : "-");
+ int start = result.size();
+ std::string modeline = adding ? "+" : "-";
+ result.push_back(modeline);
if (sequence.size() > 1)
nextsize = sequence[1].length() + 2;
- while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size))
+ while (!sequence[0].empty() && (sequence.size() > 1) && (n < ServerInstance->Config->Limits.MaxModes) && ((size + nextsize) < max_line_size))
{
- result[0] += *(sequence[0].begin());
+ modeline += *(sequence[0].begin());
if (!sequence[1].empty())
{
result.push_back(sequence[1]);
@@ -376,6 +376,7 @@ int irc::modestacker::GetStackedLine(std::deque<std::string> &result, int max_li
n++;
}
+ result[start] = modeline;
return n;
}