summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-04-15 16:45:42 +0100
committerPeter Powell <petpow@saberuk.com>2013-04-19 01:34:07 +0100
commit0d3a6719b8d924ea663f95e3e2fb834cbd80c6a5 (patch)
treed16a152c375232039ce2243145c57d3bb4aed525 /src
parent326852f7dd3fd6989d37ad2991f8a174b3a86b65 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/hashcomp.cpp37
-rw-r--r--src/modules/m_spanningtree/utils.h2
-rw-r--r--src/modules/m_watch.cpp7
3 files changed, 16 insertions, 30 deletions
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<const char*>
- */
- 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<const char*>
+ */
+ 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
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index f67a0d3c1..36c161287 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -35,7 +35,7 @@ class SpanningTreeUtilities;
/* This hash_map holds the hash equivalent of the server
* tree, used for rapid linear lookups.
*/
-typedef std::tr1::unordered_map<std::string, TreeServer*, std::tr1::insensitive, irc::StrHashComp> server_hash;
+typedef TR1NS::unordered_map<std::string, TreeServer*, irc::insensitive, irc::StrHashComp> server_hash;
typedef std::set<TreeServer*> TreeServerList;
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 60ea79a83..fdb20be2d 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -92,12 +92,7 @@
* of users using WATCH.
*/
-/*
- * Before you start screaming, this definition is only used here, so moving it to a header is pointless.
- * Yes, it's horrid. Blame cl for being different. -- w00t
- */
-
-typedef std::tr1::unordered_map<irc::string, std::deque<User*>, irc::hash> watchentries;
+typedef TR1NS::unordered_map<irc::string, std::deque<User*>, irc::hash> watchentries;
typedef std::map<irc::string, std::string> watchlist;
/* Who's watching each nickname.