summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 15:41:25 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 15:41:25 +0000
commitbb81e1a5f38b1d6487e53aa5ac69ca7ced9f6562 (patch)
tree9ed65daf0e338aebf9525b0b018b49a0437e3a4a
parentbff75471cfdb7bb5bdc57c0c879117c38a977650 (diff)
Improved strhashcomp with no allocations
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3596 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/hashcomp.cpp19
-rwxr-xr-xsrc/svn-rev.sh2
2 files changed, 12 insertions, 9 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index e94813420..10e1f331e 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -76,18 +76,21 @@ size_t nspace::hash<in_addr>::operator()(const struct in_addr &a) const
size_t nspace::hash<string>::operator()(const string &s) const
{
- char a[MAXBUF];
- static struct hash<const char *> strhash;
- strlcpy(a,s.c_str(),MAXBUF);
- strlower(a);
- return strhash(a);
+ char a[MAXBUF];
+ static struct hash<const char *> strhash;
+ strlcpy(a,s.c_str(),MAXBUF);
+ strlower(a);
+ return strhash(a);
}
bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2) const
{
- irc::string a = s1.c_str();
- irc::string b = s2.c_str();
- return (a == b);
+ char* n1 = (char*)s1.c_str();
+ char* n2 = (char*)s2.c_str();
+ for (; *n1 && *n2; n1++, n2++)
+ if (lowertab[*n1] != lowertab[*n2])
+ return false;
+ return (lowertab[*n1] == lowertab[*n2]);
}
bool irc::InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) const
diff --git a/src/svn-rev.sh b/src/svn-rev.sh
index 8acb32dfb..74ad7dc66 100755
--- a/src/svn-rev.sh
+++ b/src/svn-rev.sh
@@ -1 +1 @@
-echo 3593
+echo 3595