From: attilamolnar Date: Wed, 10 Apr 2013 15:50:49 +0000 (+0200) Subject: BanCache: Remove BanCacheManager::RehashCache() X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=2b1328c3f4b25a9f72cf2c458042ffafc2d5ad6b;p=user%2Fhenk%2Fcode%2Finspircd.git BanCache: Remove BanCacheManager::RehashCache() The function was never called --- diff --git a/include/bancache.h b/include/bancache.h index 70ec09f02..ea09d389f 100644 --- a/include/bancache.h +++ b/include/bancache.h @@ -82,7 +82,6 @@ class CoreExport BanCacheManager this->BanHash = new BanCacheHash(); } ~BanCacheManager(); - void RehashCache(); }; #endif diff --git a/src/bancache.cpp b/src/bancache.cpp index 244ffd758..784f5ded6 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -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)