diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-19 07:14:25 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-19 07:14:25 +0000 |
commit | d3b69e8098a2fd6e7bf9a96c37adcbc84f8d72aa (patch) | |
tree | 7894acc13b3d874f6470c9e2aba607334f6652ce /src/modules | |
parent | e9e2425b3f305dfd0745328e61e8ecbc6b05f2b7 (diff) |
Use rfind rather than find when chopping strings, its faster as the \r is more likely to be at the end of the sequence not the start
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5497 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 1a4f71b79..e4424a1b0 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -2074,8 +2074,12 @@ class TreeSocket : public InspSocket { std::string ret = in_buffer.substr(0,in_buffer.find("\n")-1); in_buffer = in_buffer.substr(in_buffer.find("\n")+1,in_buffer.length()-in_buffer.find("\n")); - if (ret.find("\r") != std::string::npos) - ret = in_buffer.substr(0,in_buffer.find("\r")-1); + /* Use rfind here not find, as theres more + * chance of the \r being near the end of the + * string, not the start. + */ + if (ret.rfind("\r") != std::string::npos) + ret = in_buffer.substr(0,in_buffer.rfind("\r")-1); /* Process this one, abort if it * didnt return true. */ |