From ec9bd01f58ae5354dfe1bf05798f45ec836e02f6 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 28 Aug 2006 16:45:05 +0000 Subject: Move trailing space stripping to only strip from non-last-item values (dont ask) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5049 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/hashcomp.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index f5cc5efe0..aa53da964 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -206,10 +206,6 @@ std::istream& operator>>(std::istream &is, irc::string &str) irc::tokenstream::tokenstream(const std::string &source) : tokens(source), last_pushed(false) { - /* Remove trailing spaces, these muck up token parsing */ - while (tokens.find_last_of(' ') == tokens.length() - 1) - tokens.erase(tokens.end() - 1); - /* Record starting position and current position */ last_starting_position = tokens.begin(); n = tokens.begin(); @@ -243,7 +239,12 @@ const std::string irc::tokenstream::GetToken() */ last_starting_position = n+1; last_pushed = true; - return std::string(lsp, n+1 == tokens.end() ? n+1 : n++); + + std::string strip(lsp, n+1 == tokens.end() ? n+1 : n++); + while ((strip.length()) && (strip.find_last_of(' ') == strip.length() - 1)) + strip.erase(strip.end() - 1); + + return strip; } n++; -- cgit v1.2.3