summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2012-07-06 02:47:51 +0200
committerattilamolnar <attilamolnar@hush.com>2012-07-07 15:17:28 +0200
commitce115e4f438b72abeb6a2af7b21331fb2b15842a (patch)
tree5e59bc7bce9a218a6afbce3f0b39903a99fd5a2d /src/modules
parent48c2bc4d8006d3e3eb2c20dfc7a00f78eb82bcda (diff)
m_stripcolor Removing a character from a string while iterating it is slightly less complicated
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_stripcolor.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp
index cd4f35c4b..86f307bae 100644
--- a/src/modules/m_stripcolor.cpp
+++ b/src/modules/m_stripcolor.cpp
@@ -72,8 +72,8 @@ class ModuleStripColor : public Module
{
/* refactor this completely due to SQUIT bug since the old code would strip last char and replace with \0 --peavey */
int seq = 0;
- std::string::iterator i,safei;
- for (i = sentence.begin(); i != sentence.end();)
+
+ for (std::string::iterator i = sentence.begin(); i != sentence.end();)
{
if (*i == 3)
seq = 1;
@@ -89,20 +89,7 @@ class ModuleStripColor : public Module
seq = 0;
if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31)))
- {
- if (i != sentence.begin())
- {
- safei = i;
- --i;
- sentence.erase(safei);
- ++i;
- }
- else
- {
- sentence.erase(i);
- i = sentence.begin();
- }
- }
+ i = sentence.erase(i);
else
++i;
}