From 219993bc9018d9f0d9568330d7a972b68b785d27 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:43:25 +0000 Subject: 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 --- src/hashcomp.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/hashcomp.cpp') 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 &result, int max_line_size) +int irc::modestacker::GetStackedLine(std::vector &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 &result, int max_li n++; } + result[start] = modeline; return n; } -- cgit v1.2.3