]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
BanCache: Remove BanCacheManager::RehashCache()
authorattilamolnar <attilamolnar@hush.com>
Wed, 10 Apr 2013 15:50:49 +0000 (17:50 +0200)
committerattilamolnar <attilamolnar@hush.com>
Wed, 10 Apr 2013 17:27:24 +0000 (19:27 +0200)
The function was never called

include/bancache.h
src/bancache.cpp

index 70ec09f0233ce0e5c84c05e4f0355e6a654132d3..ea09d389f25bd9ef267ec05dc027c5e9458bee07 100644 (file)
@@ -82,7 +82,6 @@ class CoreExport BanCacheManager
                this->BanHash = new BanCacheHash();
        }
        ~BanCacheManager();
-       void RehashCache();
 };
 
 #endif
index 244ffd758206f1965674e7ebcc807c700d7874e2..784f5ded611c4a3db911ca3043048b9b9bdd2505 100644 (file)
@@ -88,40 +88,6 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive)
        }
 }
 
-void BanCacheManager::RehashCache()
-{
-       BanCacheHash* NewHash = new BanCacheHash();
-
-       BanCacheHash::iterator safei;
-       for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); )
-       {
-               safei = n;
-               safei++;
-
-               /* Safe to delete items here through iterator 'n' */
-               BanCacheHit *b = n->second;
-
-               if (ServerInstance->Time() > b->Expiry)
-               {
-                       /* we need to remove this one. */
-                       delete b;
-                       BanHash->erase(n); // WORD TO THE WISE: don't use RemoveHit here, because we MUST remove the iterator in a safe way.
-               }
-               else
-               {
-                       /* Actually inserts a std::pair */
-                       NewHash->insert(*n);
-               }
-
-               /* End of safe section */
-
-               n = safei;
-       }
-
-       delete BanHash;
-       BanHash = NewHash;
-}
-
 BanCacheManager::~BanCacheManager()
 {
        for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); ++n)