From bd0413a193f185d4d7a8b26fb19b6b997489e134 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 2 Oct 2006 08:51:45 +0000 Subject: More efficient modestacker git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5390 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/hashcomp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index d0a4ab104..8a4febb60 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -321,12 +321,12 @@ void irc::modestacker::Push(char modeletter, const std::string ¶meter) sequence.push_back(parameter); } -std::deque irc::modestacker::GetStackedLine() +int irc::modestacker::GetStackedLine(std::deque &result) { - std::deque result; - result.push_back(""); + result.clear(); + result.push_back(adding ? "+" : "-"); - while (!sequence[0].empty() && (sequence.size() > 1)) + while (!sequence[0].empty() && (sequence.size() > 1) && (result.size() < MAXMODES+1)) { result[0] += *(sequence[0].begin()); result.push_back(sequence[1]); @@ -334,6 +334,6 @@ std::deque irc::modestacker::GetStackedLine() sequence.erase(sequence.begin() + 1); } - return result; + return result.size(); } -- cgit v1.2.3