aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-10-19 07:14:25 +0000
committerGravatar brain2006-10-19 07:14:25 +0000
commitd3b69e8098a2fd6e7bf9a96c37adcbc84f8d72aa (patch)
tree7894acc13b3d874f6470c9e2aba607334f6652ce /src/modules/m_spanningtree.cpp
parentRemove unused large vars (diff)
downloadinspircd++-d3b69e8098a2fd6e7bf9a96c37adcbc84f8d72aa.tar.gz
inspircd++-d3b69e8098a2fd6e7bf9a96c37adcbc84f8d72aa.tar.bz2
inspircd++-d3b69e8098a2fd6e7bf9a96c37adcbc84f8d72aa.zip
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/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp8
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.
*/