Use C++11 std::map::erase return value (#2236)

This commit is contained in:
Andrew Gaul 2023-07-27 23:34:43 +09:00 committed by GitHub
parent 38a1ff42e5
commit 36db898d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -546,7 +546,7 @@ bool StatCache::TruncateCache()
stat_cache_entry* entry = iter->second;
if(!entry || (0L == entry->notruncate && IsExpireStatCacheTime(entry->cache_date, ExpireTime))){
delete entry;
stat_cache.erase(iter++);
iter = stat_cache.erase(iter);
}else{
++iter;
}
@ -718,7 +718,7 @@ bool StatCache::TruncateSymlink()
symlink_cache_entry* entry = iter->second;
if(!entry || IsExpireStatCacheTime(entry->cache_date, ExpireTime)){ // use the same as Stats
delete entry;
symlink_cache.erase(iter++);
iter = symlink_cache.erase(iter);
}else{
++iter;
}

View File

@ -730,12 +730,12 @@ bool FdManager::Close(FdEntity* ent, int fd)
ent->Close(fd);
if(!ent->IsOpen()){
// remove found entity from map.
fent.erase(iter++);
iter = fent.erase(iter);
// check another key name for entity value to be on the safe side
for(; iter != fent.end(); ){
if(iter->second == ent){
fent.erase(iter++);
iter = fent.erase(iter);
}else{
++iter;
}
@ -754,7 +754,7 @@ bool FdManager::ChangeEntityToTempPath(FdEntity* ent, const char* path)
for(fdent_map_t::iterator iter = fent.begin(); iter != fent.end(); ){
if(iter->second == ent){
fent.erase(iter++);
iter = fent.erase(iter);
std::string tmppath;
FdManager::MakeRandomTempPath(path, tmppath);

View File

@ -2378,7 +2378,7 @@ bool FdEntity::MergeOrgMeta(headers_t& updatemeta)
// this is special cases, we remove the key which has empty values.
for(headers_t::iterator hiter = orgmeta.begin(); hiter != orgmeta.end(); ){
if(hiter->second.empty()){
orgmeta.erase(hiter++);
hiter = orgmeta.erase(hiter);
}else{
++hiter;
}