1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 #include "helperfuncs.h"
22 #include <ext/hash_map>
28 #define nspace __gnu_cxx
36 size_t hash<in_addr>::operator()(const struct in_addr &a) const
38 size_t nspace::hash<in_addr>::operator()(const struct in_addr &a) const
42 memcpy(&q,&a,sizeof(size_t));
47 size_t hash<string>::operator()(const string &s) const
49 size_t nspace::hash<string>::operator()(const string &s) const
53 static struct hash<const char *> strhash;
54 strlcpy(a,s.c_str(),MAXBUF);
59 bool StrHashComp::operator()(const string& s1, const string& s2) const
61 char a[MAXBUF],b[MAXBUF];
62 strlcpy(a,s1.c_str(),MAXBUF);
63 strlcpy(b,s2.c_str(),MAXBUF);
66 return (strcasecmp(a,b) == 0);
69 bool InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) const
74 memcpy(&q,&s1,sizeof(size_t));
75 memcpy(&p,&s2,sizeof(size_t));