From bcd91de3474a166418ae3e0c6238f5cb41827531 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 26 Jul 2012 01:47:07 +0200 Subject: m_hostchange Remove string copy --- src/modules/m_hostchange.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 21623e51b..cc7c57508 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -147,15 +147,14 @@ class ModuleHostChange : public Module { // first take their nick and strip out non-dns, leaving just [A-Z0-9\-] std::string complete; - std::string old = user->nick; - for (unsigned int j = 0; j < old.length(); j++) + for (std::string::const_iterator j = user->nick.begin(); j != user->nick.end(); ++j) { - if (((old[j] >= 'A') && (old[j] <= 'Z')) || - ((old[j] >= 'a') && (old[j] <= 'z')) || - ((old[j] >= '0') && (old[j] <= '9')) || - (old[j] == '-')) + if (((*j >= 'A') && (*j <= 'Z')) || + ((*j >= 'a') && (*j <= 'z')) || + ((*j >= '0') && (*j <= '9')) || + (*j == '-')) { - complete = complete + old[j]; + complete = complete + *j; } } if (complete.empty()) -- cgit v1.2.3