]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Improve userrec::AddBuffer (remove craq char to std::string loop)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 17 Aug 2006 14:12:10 +0000 (14:12 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 17 Aug 2006 14:12:10 +0000 (14:12 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4932 e03df62e-2008-0410-955e-edbf42e46eb7

src/users.cpp

index 43d09554d561b82cd421013343a8630955d46b72..aab40aa1dad0bd6150a27166df59c825a08ceaf8 100644 (file)
@@ -480,15 +480,13 @@ bool userrec::HasPermission(const std::string &command)
 
 bool userrec::AddBuffer(const std::string &a)
 {
-       std::string b = "";
+       std::string b(a);
+       std::string::size_type i = b.rfind('\r');
 
-       /* NB: std::string is arsey about \r and \n and tries to translate them
-        * somehow, so we CANNOT use std::string::find() here :(
-        */
-       for (std::string::const_iterator i = a.begin(); i != a.end(); i++)
+       while (i != std::string::npos)
        {
-               if (*i != '\r')
-                       b += *i;
+               b.erase(i, 1);
+               i = b.rfind('\r');
        }
 
        if (b.length())