summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 19:27:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-15 19:27:38 +0000
commit76317750956e2bf4b80478e4f0f04160d12347ce (patch)
tree2ccc60857c6130e32481e90d0a0e24d624217107
parent5de064387b5d47725ff278ae537c97f0a0f4a21e (diff)
Updated strhashcomp to use irc::string internally rather than a combination of strlower and strcasecmp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1400 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/hashcomp.h11
-rw-r--r--src/hashcomp.cpp9
2 files changed, 14 insertions, 6 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index b4652642b..32d155e30 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -19,6 +19,17 @@
#include "inspircd_config.h"
+/**
+ * This file contains classes and templates that deal
+ * with the comparison and hashing of 'irc strings'.
+ * An 'irc string' is a string which compares in a
+ * case insensitive manner, and as per RFC 1459 will
+ * treat [ identical to {, ] identical to }, and \
+ * as identical to |. Our hashing functions are designed
+ * to accept std::string and compare/hash them in an irc
+ * type way, irc::string is a seperate class type currently.
+ */
+
#ifdef GCC3
#include <ext/hash_map>
#else
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index ca7394baa..96811715d 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -82,12 +82,9 @@ size_t nspace::hash<string>::operator()(const string &s) const
bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2) const
{
- char a[MAXBUF],b[MAXBUF];
- strlcpy(a,s1.c_str(),MAXBUF);
- strlcpy(b,s2.c_str(),MAXBUF);
- strlower(a);
- strlower(b);
- return (strcasecmp(a,b) == 0);
+ irc::string a = s1.c_str();
+ irc::string b = s2.c_str();
+ return (a == b);
}
bool irc::InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) const