diff options
author | Attila Molnar <attilamolnar@hush.com> | 2013-04-01 09:50:50 -0700 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2013-04-01 09:50:50 -0700 |
commit | 66b90807bb94d88c8a34ec8a1fd7c1558941c47a (patch) | |
tree | b2147238c609c5b1733c518b1b932b0e40ddb8a0 | |
parent | 80e88c163dbd77b06b61d4fd734d51249cc0e172 (diff) | |
parent | fd655fa93a00a5f2993adb7ef562b6dbab8aa87c (diff) |
Merge pull request #452 from SaberUK/master+nuke-hashmap
Purge the deprecated hash_map from existance.
-rw-r--r-- | include/bancache.h | 2 | ||||
-rw-r--r-- | include/dns.h | 2 | ||||
-rw-r--r-- | include/hash_map.h | 59 | ||||
-rw-r--r-- | include/hashcomp.h | 81 | ||||
-rw-r--r-- | include/inspircd.h | 6 | ||||
-rw-r--r-- | include/typedefs.h | 11 | ||||
-rw-r--r-- | src/hashcomp.cpp | 186 | ||||
-rw-r--r-- | src/modes/cmode_b.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 6 | ||||
-rw-r--r-- | src/modules/m_watch.cpp | 2 |
10 files changed, 127 insertions, 231 deletions
diff --git a/include/bancache.h b/include/bancache.h index a7aac7f17..a99e97856 100644 --- a/include/bancache.h +++ b/include/bancache.h @@ -65,7 +65,7 @@ class CoreExport BanCacheHit /* A container of ban cache items. * must be defined after class BanCacheHit. */ -typedef nspace::hash_map<std::string, BanCacheHit*, nspace::hash<std::string> > BanCacheHash; +typedef std::tr1::unordered_map<std::string, BanCacheHit*, std::tr1::hash<std::string> > BanCacheHash; /** A manager for ban cache, which allocates and deallocates and checks cached bans. */ diff --git a/include/dns.h b/include/dns.h index 27c3c8848..3c8e55d08 100644 --- a/include/dns.h +++ b/include/dns.h @@ -102,7 +102,7 @@ class CoreExport CachedQuery /** DNS cache information. Holds IPs mapped to hostnames, and hostnames mapped to IPs. */ -typedef nspace::hash_map<irc::string, CachedQuery, irc::hash> dnscache; +typedef std::tr1::unordered_map<irc::string, CachedQuery, irc::hash> dnscache; /** * Error types that class Resolver can emit to its error method. diff --git a/include/hash_map.h b/include/hash_map.h deleted file mode 100644 index 1b43f0118..000000000 --- a/include/hash_map.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * InspIRCd -- Internet Relay Chat Daemon - * - * Copyright (C) 2009 Robin Burchell <robin+git@viroteck.net> - * Copyright (C) 2008 Craig Edwards <craigedwards@brainbox.cc> - * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org> - * Copyright (C) 2006 Oliver Lupton <oliverlupton@gmail.com> - * - * This file is part of InspIRCd. InspIRCd is free software: you can - * redistribute it and/or modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef INSPIRCD_HASHMAP_H -#define INSPIRCD_HASHMAP_H - - /** Where hash_map is varies from compiler to compiler - * as it is not standard unless we have tr1. - * - * TODO: in 2.2 if we drop support for libstdc++ older than 3.4.7 and GCC older - * than 4.1 this can be cleaned up massively. - */ - #ifndef _WIN32 - #if __GLIBCXX__ > 20060309 - // GCC4+ has deprecated hash_map and uses tr1. But of course, uses a different include to MSVC. FOR FUCKS SAKE. - #include <tr1/unordered_map> - #define HAS_TR1_UNORDERED - #define HASHMAP_DEPRECATED - #else - #include <ext/hash_map> - /** Oddball linux namespace for hash_map */ - #define nspace __gnu_cxx - #define BEGIN_HASHMAP_NAMESPACE namespace nspace { - #define END_HASHMAP_NAMESPACE } - #endif - #else - #include <unordered_map> - #define HAS_TR1_UNORDERED - #define HASHMAP_DEPRECATED - #endif - - // tr1: restoring sanity to our headers. now if only compiler vendors could agree on a FUCKING INCLUDE FILE. - #ifdef HAS_TR1_UNORDERED - #define hash_map unordered_map - #define nspace std::tr1 - #define BEGIN_HASHMAP_NAMESPACE namespace std { namespace tr1 { - #define END_HASHMAP_NAMESPACE } } - #endif - -#endif diff --git a/include/hashcomp.h b/include/hashcomp.h index b75214181..2932f2a48 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -31,7 +31,7 @@ #include <deque> #include <map> #include <set> -#include "hash_map.h" +#include "inspircd.h" /******************************************************* * This file contains classes and templates that deal @@ -583,71 +583,22 @@ inline std::string& trim(std::string &str) return str; } -/** Hashing stuff is totally different on vc++'s hash_map implementation, so to save a buttload of - * \#ifdefs we'll just do it all at once. Except, of course, with TR1, when it's the same as GCC. - */ -BEGIN_HASHMAP_NAMESPACE - - /** Hashing function to hash irc::string - */ -#if defined(_WIN32) && !defined(HAS_TR1_UNORDERED) - template<> class CoreExport hash_compare<irc::string, std::less<irc::string> > - { - public: - enum { bucket_size = 4, min_buckets = 8 }; /* Got these numbers from the CRT source, if anyone wants to change them feel free. */ - - /** Compare two irc::string values for hashing in hash_map - */ - bool operator()(const irc::string & s1, const irc::string & s2) const - { - if(s1.length() != s2.length()) return true; - return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), (size_t)s1.length()) < 0); - } - - /** Hash an irc::string value for hash_map - */ - size_t operator()(const irc::string & s) const; - }; - - template<> class CoreExport hash_compare<std::string, std::less<std::string> > +namespace std +{ + namespace tr1 { - public: - enum { bucket_size = 4, min_buckets = 8 }; /* Again, from the CRT source */ - - /** Compare two std::string values for hashing in hash_map - */ - bool operator()(const std::string & s1, const std::string & s2) const + + struct insensitive { - if(s1.length() != s2.length()) return true; - return (irc::irc_char_traits::compare(s1.c_str(), s2.c_str(), (size_t)s1.length()) < 0); - } - - /** Hash a std::string using RFC1459 case sensitivity rules - * @param s A string to hash - * @return The hash value - */ - size_t operator()(const std::string & s) const; - }; -#else - - /* XXX FIXME: Implement a hash function overriding std::string's that works with TR1! */ - -#ifdef HASHMAP_DEPRECATED - struct insensitive -#else - CoreExport template<> struct hash<std::string> -#endif - { - size_t CoreExport operator()(const std::string &s) const; - }; - -#endif - - /** Convert a string to lower case respecting RFC1459 - * @param n A string to lowercase - */ - void strlower(char *n); - -END_HASHMAP_NAMESPACE + size_t CoreExport operator()(const std::string &s) const; + }; + + /** Convert a string to lower case respecting RFC1459 + * @param n A string to lowercase + */ + void strlower(char *n); + + } +} #endif diff --git a/include/inspircd.h b/include/inspircd.h index 6b7a01b95..13cd92451 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -67,6 +67,11 @@ #include <unistd.h> #endif +#ifdef _WIN32 +# include <unordered_map> +#else +# include <tr1/unordered_map> +#endif #include <sstream> #include <string> #include <vector> @@ -874,3 +879,4 @@ class CommandModule : public Module }; #endif + diff --git a/include/typedefs.h b/include/typedefs.h index 06f704120..e73790667 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -56,13 +56,8 @@ struct ResourceRecord; #include "hashcomp.h" #include "base.h" -#ifdef HASHMAP_DEPRECATED - typedef nspace::hash_map<std::string, User*, nspace::insensitive, irc::StrHashComp> user_hash; - typedef nspace::hash_map<std::string, Channel*, nspace::insensitive, irc::StrHashComp> chan_hash; -#else - typedef nspace::hash_map<std::string, User*, nspace::hash<std::string>, irc::StrHashComp> user_hash; - typedef nspace::hash_map<std::string, Channel*, nspace::hash<std::string>, irc::StrHashComp> chan_hash; -#endif +typedef std::tr1::unordered_map<std::string, User*, std::tr1::insensitive, irc::StrHashComp> user_hash; +typedef std::tr1::unordered_map<std::string, Channel*, std::tr1::insensitive, irc::StrHashComp> chan_hash; /** A list holding local users, this is the type of UserManager::local_users */ @@ -120,7 +115,7 @@ typedef std::map<std::string, file_cache> ConfigFileCache; /** A hash of commands used by the core */ -typedef nspace::hash_map<std::string,Command*> Commandtable; +typedef std::tr1::unordered_map<std::string,Command*> Commandtable; /** Membership list of a channel */ typedef std::map<User*, Membership*> UserMembList; diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 3fb7f84fb..a1e08bbf7 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -24,7 +24,6 @@ #include "inspircd.h" #include "hashcomp.h" -#include "hash_map.h" /****************************************************** * @@ -35,7 +34,7 @@ * scene spend a lot of time debating (arguing) about * the best way to write hash functions to hash irc * nicknames, channels etc. - * We are lucky as C++ developers as hash_map does + * We are lucky as C++ developers as unordered_map does * a lot of this for us. It does intellegent memory * requests, bucketing, search functions, insertion * and deletion etc. All we have to do is write some @@ -51,74 +50,111 @@ * ******************************************************/ -/** A mapping of uppercase to lowercase, including scandinavian - * 'oddities' as specified by RFC1459, e.g. { -> [, and | -> \ + +/** + * A case insensitive mapping of characters from upper case to lower case for + * the ASCII character set. */ -unsigned const char rfc_case_insensitive_map[256] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 0-19 */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 20-39 */ - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, /* 40-59 */ - 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, /* 60-79 */ - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 94, 95, 96, 97, 98, 99, /* 80-99 */ - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, /* 100-119 */ - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, /* 120-139 */ - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, /* 140-159 */ - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, /* 160-179 */ - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, /* 180-199 */ - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 200-219 */ - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, /* 220-239 */ - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */ +unsigned const char ascii_case_insensitive_map[256] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0-9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10-19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20-29 + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, // 30-39 + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, // 40-49 + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, // 50-59 + 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, // 60-69 + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 70-79 + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, // 80-89 + 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, // 90-99 + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, // 100-109 + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, // 110-119 + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, // 120-129 + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, // 130-139 + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, // 140-149 + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 150-159 + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, // 160-169 + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, // 170-179 + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, // 180-189 + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, // 190-199 + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, // 200-209 + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, // 210-219 + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 220-229 + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 230-249 + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 240-249 + 250, 251, 252, 253, 254, 255, // 250-255 }; -/** Case insensitive map, ASCII rules. - * That is; - * [ != {, but A == a. + + +/** + * A case insensitive mapping of characters from upper case to lower case for + * the character set of RFC 1459. This is identical to ASCII with the small + * exception of {}| being considered to be the lower case equivalents of the + * characters []\ respectively. */ -unsigned const char ascii_case_insensitive_map[256] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 0-19 */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, /* 20-39 */ - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, /* 40-59 */ - 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, /* 60-79 */ - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, /* 80-99 */ - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, /* 100-119 */ - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, /* 120-139 */ - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, /* 140-159 */ - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, /* 160-179 */ - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, /* 180-199 */ - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, /* 200-219 */ - 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, /* 220-239 */ - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 /* 240-255 */ +unsigned const char rfc_case_insensitive_map[256] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0-9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10-19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20-29 + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, // 30-39 + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, // 40-49 + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, // 50-59 + 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, // 60-69 + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 70-79 + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, // 80-89 + 122, 123, 124, 125, 94, 95, 96, 97, 98, 99, // 90-99 + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, // 100-109 + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, // 110-119 + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, // 120-129 + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, // 130-139 + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, // 140-149 + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 150-159 + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, // 160-169 + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, // 170-179 + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, // 180-189 + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, // 190-199 + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, // 200-209 + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, // 210-219 + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 220-229 + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 230-239 + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 240-249 + 250, 251, 252, 253, 254, 255, // 250-255 }; -/** Case sensitive map. - * Can technically also be used for ASCII case sensitive comparisons, as [ != {, etc. +/** + * A case sensitive mapping of characters from upper case to lower case for the + * character set of RFC 1459. This is identical to ASCII. */ unsigned const char rfc_case_sensitive_map[256] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // 0-9 + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, // 10-19 + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, // 20-29 + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, // 30-39 + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, // 40-49 + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, // 50-59 + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, // 60-69 + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 70-79 + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, // 80-89 + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, // 90-99 + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, // 100-109 + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, // 110-119 + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, // 120-129 + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, // 130-139 + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, // 140-149 + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 150-159 + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, // 160-169 + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, // 170-179 + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, // 180-189 + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, // 190-199 + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, // 200-209 + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, // 210-219 + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 220-229 + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 230-239 + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 240-249 + 250, 251, 252, 253, 254, 255, // 250-255 }; -/* convert a string to lowercase. Note following special circumstances - * taken from RFC 1459. Many "official" server branches still hold to this - * rule so i will too; - * - * Because of IRC's scandanavian origin, the characters {}| are - * considered to be the lower case equivalents of the characters []\, - * respectively. This is a critical issue when determining the - * equivalence of two nicknames. - */ -void nspace::strlower(char *n) +void std::tr1::strlower(char *n) { if (n) { @@ -127,12 +163,7 @@ void nspace::strlower(char *n) } } -#ifdef HASHMAP_DEPRECATED - size_t CoreExport nspace::insensitive::operator()(const std::string &s) const -#else - size_t nspace::hash<std::string>::operator()(const std::string &s) const -#endif - +size_t std::tr1::insensitive::operator()(const std::string &s) const { /* XXX: NO DATA COPIES! :) * The hash function here is practically @@ -146,7 +177,6 @@ void nspace::strlower(char *n) return t; } - size_t CoreExport irc::hash::operator()(const irc::string &s) const { register size_t t = 0; @@ -549,25 +579,3 @@ long irc::portparser::GetToken() return atoi(x.c_str()); } } - -/*const std::basic_string& SearchAndReplace(std::string& text, const std::string& pattern, const std::string& replace) -{ - std::string replacement; - if ((!pattern.empty()) && (!text.empty())) - { - for (std::string::size_type n = 0; n != text.length(); ++n) - { - if (text.length() >= pattern.length() && text.substr(n, pattern.length()) == pattern) - { - replacement.append(replace); - n = n + pattern.length() - 1; - } - else - { - replacement += text[n]; - } - } - } - text = replacement; - return text; -}*/ diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 09df05100..339833c92 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -21,9 +21,8 @@ #include "inspircd.h" #include <string> #include <vector> -#include "inspircd_config.h" +#include "inspircd.h" #include "configreader.h" -#include "hash_map.h" #include "mode.h" #include "channels.h" #include "users.h" diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 7d5ffa216..0d44cd24f 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -36,11 +36,7 @@ class SpanningTreeUtilities; /* This hash_map holds the hash equivalent of the server * tree, used for rapid linear lookups. */ -#ifdef HASHMAP_DEPRECATED - typedef nspace::hash_map<std::string, TreeServer*, nspace::insensitive, irc::StrHashComp> server_hash; -#else - typedef nspace::hash_map<std::string, TreeServer*, nspace::hash<std::string>, irc::StrHashComp> server_hash; -#endif +typedef std::tr1::unordered_map<std::string, TreeServer*, std::tr1::insensitive, irc::StrHashComp> server_hash; typedef std::map<TreeServer*,TreeServer*> TreeServerList; diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index ec38edc31..3b87ed4c3 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -97,7 +97,7 @@ * Yes, it's horrid. Blame cl for being different. -- w00t */ -typedef nspace::hash_map<irc::string, std::deque<User*>, irc::hash> watchentries; +typedef std::tr1::unordered_map<irc::string, std::deque<User*>, irc::hash> watchentries; typedef std::map<irc::string, std::string> watchlist; /* Who's watching each nickname. |