From: brain Date: Thu, 9 Mar 2006 15:41:25 +0000 (+0000) Subject: Improved strhashcomp with no allocations X-Git-Tag: v2.0.23~8500 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=bb81e1a5f38b1d6487e53aa5ac69ca7ced9f6562;p=user%2Fhenk%2Fcode%2Finspircd.git Improved strhashcomp with no allocations git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3596 e03df62e-2008-0410-955e-edbf42e46eb7 --- 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::operator()(const struct in_addr &a) const size_t nspace::hash::operator()(const string &s) const { - char a[MAXBUF]; - static struct hash strhash; - strlcpy(a,s.c_str(),MAXBUF); - strlower(a); - return strhash(a); + char a[MAXBUF]; + static struct hash 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