From 636f32fcd0ac8bdd5bb70e04b6205d9980ef344e Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 15 May 2005 18:35:39 +0000 Subject: [PATCH] Moved StrHashComp and InAddr_HashComp into the irc:: namespace git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1398 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/hashcomp.h | 43 +++++++++++++++++++++++-------------------- src/commands.cpp | 8 ++++---- src/dnsqueue.cpp | 8 ++++---- src/hashcomp.cpp | 4 ++-- src/helperfuncs.cpp | 4 ++-- src/inspircd.cpp | 8 ++++---- src/modules.cpp | 8 ++++---- src/xline.cpp | 8 ++++---- 8 files changed, 47 insertions(+), 44 deletions(-) diff --git a/include/hashcomp.h b/include/hashcomp.h index c9debd698..b4652642b 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -53,32 +53,35 @@ namespace nspace }; } -/** This class returns true if two strings match. - * Case sensitivity is ignored, and the RFC 'character set' - * is adhered to +/** The irc namespace contains a number of helper classes. */ -struct StrHashComp +namespace irc { - /** The operator () does the actual comparison in hash_map + + /** This class returns true if two strings match. + * Case sensitivity is ignored, and the RFC 'character set' + * is adhered to */ - bool operator()(const string& s1, const string& s2) const; -}; + struct StrHashComp + { + /** The operator () does the actual comparison in hash_map + */ + bool operator()(const std::string& s1, const std::string& s2) const; + }; -/** This class returns true if two in_addr structs match. - * Checking is done by copying both into a size_t then doing a - * numeric comparison of the two. - */ -struct InAddr_HashComp -{ - /** The operator () does the actual comparison in hash_map + + /** This class returns true if two in_addr structs match. + * Checking is done by copying both into a size_t then doing a + * numeric comparison of the two. */ - bool operator()(const in_addr &s1, const in_addr &s2) const; -}; + struct InAddr_HashComp + { + /** The operator () does the actual comparison in hash_map + */ + bool operator()(const in_addr &s1, const in_addr &s2) const; + }; + -/** The irc namespace contains a number of helper classes. - */ -namespace irc -{ /** The irc_char_traits class is used for RFC-style comparison of strings. * This class is used to implement irc::string, a case-insensitive, RFC- * comparing string class. diff --git a/src/commands.cpp b/src/commands.cpp index 3dfa44d9f..23d285eee 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -124,10 +124,10 @@ const long duration_d = duration_h * 24; const long duration_w = duration_d * 7; const long duration_y = duration_w * 52; -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; -typedef nspace::hash_map, InAddr_HashComp> address_cache; -typedef nspace::hash_map, StrHashComp> whowas_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; +typedef nspace::hash_map, irc::InAddr_HashComp> address_cache; +typedef nspace::hash_map, irc::StrHashComp> whowas_hash; typedef std::deque command_table; diff --git a/src/dnsqueue.cpp b/src/dnsqueue.cpp index 9d77543e9..1a5113618 100644 --- a/src/dnsqueue.cpp +++ b/src/dnsqueue.cpp @@ -72,10 +72,10 @@ extern std::vector fd_reap; extern int MODCOUNT; -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; -typedef nspace::hash_map, InAddr_HashComp> address_cache; -typedef nspace::hash_map, StrHashComp> whowas_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; +typedef nspace::hash_map, irc::InAddr_HashComp> address_cache; +typedef nspace::hash_map, irc::StrHashComp> whowas_hash; typedef std::deque command_table; extern user_hash clientlist; diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index a076dc46b..ca7394baa 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -80,7 +80,7 @@ size_t nspace::hash::operator()(const string &s) const return strhash(a); } -bool StrHashComp::operator()(const string& s1, const string& s2) 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); @@ -90,7 +90,7 @@ bool StrHashComp::operator()(const string& s1, const string& s2) const return (strcasecmp(a,b) == 0); } -bool InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) const +bool irc::InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) const { size_t q; size_t p; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 20b924013..5649b6ca1 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -78,8 +78,8 @@ extern std::vector all_opers; extern ClassVector Classes; -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; typedef std::deque command_table; extern user_hash clientlist; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 56d476c48..4464be755 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -107,10 +107,10 @@ time_t TIME = time(NULL), OLDTIME = time(NULL); int kq, lkq, skq; #endif -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; -typedef nspace::hash_map, InAddr_HashComp> address_cache; -typedef nspace::hash_map, StrHashComp> whowas_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; +typedef nspace::hash_map, irc::InAddr_HashComp> address_cache; +typedef nspace::hash_map, irc::StrHashComp> whowas_hash; typedef std::deque command_table; // This table references users by file descriptor. diff --git a/src/modules.cpp b/src/modules.cpp index fba0db10a..c0dcc3ca7 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -106,10 +106,10 @@ extern FILE *log_file; extern userrec* fd_ref_table[65536]; -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; -typedef nspace::hash_map, InAddr_HashComp> address_cache; -typedef nspace::hash_map, StrHashComp> whowas_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; +typedef nspace::hash_map, irc::InAddr_HashComp> address_cache; +typedef nspace::hash_map, irc::StrHashComp> whowas_hash; typedef std::deque command_table; diff --git a/src/xline.cpp b/src/xline.cpp index 1d0bcf775..fa400d5c5 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -92,10 +92,10 @@ extern serverrec* me[32]; extern FILE *log_file; -typedef nspace::hash_map, StrHashComp> user_hash; -typedef nspace::hash_map, StrHashComp> chan_hash; -typedef nspace::hash_map, InAddr_HashComp> address_cache; -typedef nspace::hash_map, StrHashComp> whowas_hash; +typedef nspace::hash_map, irc::StrHashComp> user_hash; +typedef nspace::hash_map, irc::StrHashComp> chan_hash; +typedef nspace::hash_map, irc::InAddr_HashComp> address_cache; +typedef nspace::hash_map, irc::StrHashComp> whowas_hash; typedef std::deque command_table; -- 2.39.2