From 0d3a6719b8d924ea663f95e3e2fb834cbd80c6a5 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 15 Apr 2013 16:45:42 +0100 Subject: Fix building with libc++. - Purged std::tr1::strlower (was never used). - Moved std::tr1::insensitive to irc::insensitive. - Added TR1NS macro to point to the correct C++ TR1 namespace. --- src/hashcomp.cpp | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'src/hashcomp.cpp') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index a1e08bbf7..25abd471f 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -154,29 +154,6 @@ unsigned const char rfc_case_sensitive_map[256] = { 250, 251, 252, 253, 254, 255, // 250-255 }; -void std::tr1::strlower(char *n) -{ - if (n) - { - for (char* t = n; *t; t++) - *t = national_case_insensitive_map[(unsigned char)*t]; - } -} - -size_t std::tr1::insensitive::operator()(const std::string &s) const -{ - /* XXX: NO DATA COPIES! :) - * The hash function here is practically - * a copy of the one in STL's hash_fun.h, - * only with *x replaced with national_case_insensitive_map[*x]. - * This avoids a copy to use hash - */ - register size_t t = 0; - for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */ - t = 5 * t + national_case_insensitive_map[(unsigned char)*x]; - return t; -} - size_t CoreExport irc::hash::operator()(const irc::string &s) const { register size_t t = 0; @@ -195,6 +172,20 @@ bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2) return (national_case_insensitive_map[*n1] == national_case_insensitive_map[*n2]); } +size_t irc::insensitive::operator()(const std::string &s) const +{ + /* XXX: NO DATA COPIES! :) + * The hash function here is practically + * a copy of the one in STL's hash_fun.h, + * only with *x replaced with national_case_insensitive_map[*x]. + * This avoids a copy to use hash + */ + register size_t t = 0; + for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */ + t = 5 * t + national_case_insensitive_map[(unsigned char)*x]; + return t; +} + /****************************************************** * * This is the implementation of our special irc::string -- cgit v1.2.3