]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/hashcomp.cpp
Add <options:cyclehosts> which allows a user to appear to have quit when their host...
[user/henk/code/inspircd.git] / src / hashcomp.cpp
index bf90eaeb8a5767be53e99321a36a23bbbf0712f7..f5cc5efe05c71e3e154ba31eb8897af60c7d4e19 100644 (file)
@@ -3,13 +3,13 @@
  *       +------------------------------------+
  *
  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *                <Craig@chatspike.net>
+ *                    E-mail:
+ *             <brain@chatspike.net>
+ *             <Craig@chatspike.net>
  *
  * Written by Craig Edwards, Craig McLure, and others.
  * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ *         the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -20,14 +20,11 @@ using namespace std;
 #include "inspircd.h"
 #include <string>
 #include "hashcomp.h"
-#include "helperfuncs.h"
+
 #include <ext/hash_map>
 
 #define nspace __gnu_cxx
 
-// from helperfuncs.cpp
-extern const char lowermap[255];
-
 /******************************************************
  *
  * The hash functions of InspIRCd are the centrepoint
@@ -71,11 +68,11 @@ using namespace irc::sockets;
  */
 void nspace::strlower(char *n)
 {
-        if (n)
-        {
-                for (char* t = n; *t; t++)
-                        *t = lowermap[(unsigned char)*t];
-        }
+       if (n)
+       {
+               for (char* t = n; *t; t++)
+                       *t = lowermap[(unsigned char)*t];
+       }
 }
 
 size_t nspace::hash<insp_inaddr>::operator()(const insp_inaddr &a) const
@@ -91,8 +88,8 @@ size_t nspace::hash<string>::operator()(const string &s) const
        size_t t = 0;
        static struct hash<const char *> strhash;
 
-       for (const char* x = s.c_str(); *x; x++, t++)   /* Faster to do it this way than */
-               a[t] = lowermap[(unsigned char)*x];     /* Seperate strlcpy and strlower */
+       for (const char* x = s.c_str(); *x; x++)        /* Faster to do it this way than */
+               a[t++] = lowermap[(unsigned char)*x];   /* Seperate strlcpy and strlower */
 
        a[t] = 0;
 
@@ -128,9 +125,7 @@ bool irc::InAddr_HashComp::operator()(const insp_inaddr &s1, const insp_inaddr &
  * std::string which is not only case-insensitive but
  * can also do scandanavian comparisons, e.g. { = [, etc.
  *
- * This class depends on the global 'lowermap' which is
- * initialized at startup by inspircd.cpp, and contains
- * the 'scandanavian' casemappings for fast irc compare.
+ * This class depends on the const array 'lowermap'.
  *
  ******************************************************/