aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_ldapauth.cpp
diff options
context:
space:
mode:
authorGravatar Attila Molnar2015-01-10 15:16:03 +0100
committerGravatar Attila Molnar2015-01-10 15:16:03 +0100
commit47dda4f61512f6047f2b1dcccd1943aab74726e3 (patch)
treea1425a9dbff58b97ef5dcdf169e0d65439513527 /src/modules/m_ldapauth.cpp
parentRemove the unused OnGlobalOper hook (diff)
downloadinspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.tar.gz
inspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.tar.bz2
inspircd++-47dda4f61512f6047f2b1dcccd1943aab74726e3.zip
Reduce std::string::substr() usage
substr() returns a new string while erase() and assign() modify the existing one
Diffstat (limited to 'src/modules/m_ldapauth.cpp')
-rw-r--r--src/modules/m_ldapauth.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp
index e89ce4949..eee357ec0 100644
--- a/src/modules/m_ldapauth.cpp
+++ b/src/modules/m_ldapauth.cpp
@@ -64,7 +64,7 @@ class BindInterface : public LDAPInterface
while (i < text.length() - 1 && isalpha(text[i + 1]))
++i;
- std::string key = text.substr(start, (i - start) + 1);
+ std::string key(start, (i - start) + 1);
result.append(replacements[key]);
}
else
@@ -90,8 +90,8 @@ class BindInterface : public LDAPInterface
if (pos == std::string::npos) // malformed
continue;
- std::string key = dnPart.substr(0, pos);
- std::string value = dnPart.substr(pos + 1, dnPart.length() - pos + 1); // +1s to skip the = itself
+ std::string key(dnPart, 0, pos);
+ std::string value(dnPart, pos + 1, dnPart.length() - pos + 1); // +1s to skip the = itself
dnParts[key] = value;
}