diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-06-13 15:14:31 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-06-13 15:14:31 +0200 |
commit | 01de0a19ad49f71f7d2a4b9fbcb80c0713a90d7d (patch) | |
tree | 4eacb23747489881a5fe4bf364479560f8b649c5 /src | |
parent | b071a6acd805bde6119a66481768be13102d1c2b (diff) |
Change allocation of BanCacheManager::BanHash to be physically part of the object containing it
Diffstat (limited to 'src')
-rw-r--r-- | src/bancache.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp index 4bb2fa82c..a49454381 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -23,7 +23,7 @@ BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds) { - BanCacheHit*& b = (*BanHash)[ip]; + BanCacheHit*& b = BanHash[ip]; if (b != NULL) // can't have two cache entries on the same IP, sorry.. return NULL; @@ -33,9 +33,9 @@ BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &t BanCacheHit *BanCacheManager::GetHit(const std::string &ip) { - BanCacheHash::iterator i = this->BanHash->find(ip); + BanCacheHash::iterator i = this->BanHash.find(ip); - if (i == this->BanHash->end()) + if (i == this->BanHash.end()) return NULL; // free and safe if (RemoveIfExpired(i)) @@ -51,7 +51,7 @@ bool BanCacheManager::RemoveIfExpired(BanCacheHash::iterator& it) ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "Hit on " + it->first + " is out of date, removing!"); delete it->second; - it = BanHash->erase(it); + it = BanHash.erase(it); return true; } @@ -62,7 +62,7 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive) else ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing all negative hits"); - for (BanCacheHash::iterator i = BanHash->begin(); i != BanHash->end(); ) + for (BanCacheHash::iterator i = BanHash.begin(); i != BanHash.end(); ) { if (RemoveIfExpired(i)) continue; // updates the iterator if expired @@ -86,7 +86,7 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive) /* we need to remove this one. */ ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCacheManager::RemoveEntries(): Removing a hit on " + i->first); delete b; - i = BanHash->erase(i); + i = BanHash.erase(i); } else ++i; @@ -95,7 +95,6 @@ void BanCacheManager::RemoveEntries(const std::string& type, bool positive) BanCacheManager::~BanCacheManager() { - for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); ++n) + for (BanCacheHash::iterator n = BanHash.begin(); n != BanHash.end(); ++n) delete n->second; - delete BanHash; } |