diff options
| author | 2006-08-10 19:29:43 +0000 | |
|---|---|---|
| committer | 2006-08-10 19:29:43 +0000 | |
| commit | fd200c4163d2488bb27ab1b742277950c248bc05 (patch) | |
| tree | 89f1bdb1189c58e84e5725b3d0de4f94caf05fca /src/hashcomp.cpp | |
| parent | Dont try and write to a user after theyve parted (diff) | |
2x faster hashing function backported from trunk (its so groovy, we'll consider it a fix)
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4854 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/hashcomp.cpp')
| -rw-r--r-- | src/hashcomp.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 50776802c..9556336ce 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -68,10 +68,15 @@ 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]; + char a[s.length()]; + size_t t = 0; static struct hash<const char *> strhash; - strlcpy(a,s.c_str(),MAXBUF); - strlower(a); + + for (const char* x = s.c_str(); *x; x++) /* Faster to do it this way than */ + a[t++] = lowermap[(unsigned char)*x]; /* Seperate strlcpy and strlower */ + + a[t] = 0; + return strhash(a); } |
