mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 08:48:55 +00:00
Merge pull request #954 from gaul/clear-iter
Clear containers instead of individual erases
This commit is contained in:
commit
e07cb020cc
@ -213,9 +213,10 @@ void StatCache::Clear()
|
||||
{
|
||||
AutoLock lock(&StatCache::stat_cache_lock);
|
||||
|
||||
for(stat_cache_t::iterator iter = stat_cache.begin(); iter != stat_cache.end(); stat_cache.erase(iter++)){
|
||||
for(stat_cache_t::iterator iter = stat_cache.begin(); iter != stat_cache.end(); ++iter){
|
||||
delete (*iter).second;
|
||||
}
|
||||
stat_cache.clear();
|
||||
S3FS_MALLOCTRIM(0);
|
||||
}
|
||||
|
||||
|
14
src/curl.cpp
14
src/curl.cpp
@ -3974,21 +3974,24 @@ S3fsMultiCurl::~S3fsMultiCurl()
|
||||
bool S3fsMultiCurl::ClearEx(bool is_all)
|
||||
{
|
||||
s3fscurlmap_t::iterator iter;
|
||||
for(iter = cMap_req.begin(); iter != cMap_req.end(); cMap_req.erase(iter++)){
|
||||
for(iter = cMap_req.begin(); iter != cMap_req.end(); ++iter){
|
||||
S3fsCurl* s3fscurl = (*iter).second;
|
||||
if(s3fscurl){
|
||||
s3fscurl->DestroyCurlHandle();
|
||||
delete s3fscurl; // with destroy curl handle.
|
||||
}
|
||||
}
|
||||
cMap_req.clear();
|
||||
|
||||
if(is_all){
|
||||
for(iter = cMap_all.begin(); iter != cMap_all.end(); cMap_all.erase(iter++)){
|
||||
for(iter = cMap_all.begin(); iter != cMap_all.end(); ++iter){
|
||||
S3fsCurl* s3fscurl = (*iter).second;
|
||||
s3fscurl->DestroyCurlHandle();
|
||||
delete s3fscurl;
|
||||
}
|
||||
cMap_all.clear();
|
||||
}
|
||||
|
||||
S3FS_MALLOCTRIM(0);
|
||||
|
||||
return true;
|
||||
@ -4094,7 +4097,7 @@ int S3fsMultiCurl::MultiPerform()
|
||||
|
||||
int S3fsMultiCurl::MultiRead()
|
||||
{
|
||||
for(s3fscurlmap_t::iterator iter = cMap_req.begin(); iter != cMap_req.end(); cMap_req.erase(iter++)) {
|
||||
for(s3fscurlmap_t::iterator iter = cMap_req.begin(); iter != cMap_req.end(); ++iter) {
|
||||
S3fsCurl* s3fscurl = (*iter).second;
|
||||
|
||||
bool isRetry = false;
|
||||
@ -4155,6 +4158,8 @@ int S3fsMultiCurl::MultiRead()
|
||||
}
|
||||
}
|
||||
}
|
||||
cMap_req.clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4171,12 +4176,13 @@ int S3fsMultiCurl::Request()
|
||||
// set curl handle to multi handle
|
||||
int result;
|
||||
s3fscurlmap_t::iterator iter;
|
||||
for(iter = cMap_all.begin(); iter != cMap_all.end(); cMap_all.erase(iter++)){
|
||||
for(iter = cMap_all.begin(); iter != cMap_all.end(); ++iter){
|
||||
CURL* hCurl = (*iter).first;
|
||||
S3fsCurl* s3fscurl = (*iter).second;
|
||||
|
||||
cMap_req[hCurl] = s3fscurl;
|
||||
}
|
||||
cMap_all.clear();
|
||||
|
||||
// Send multi request.
|
||||
if(0 != (result = MultiPerform())){
|
||||
|
@ -2884,9 +2884,10 @@ static int remote_mountpath_exists(const char* path)
|
||||
|
||||
static void free_xattrs(xattrs_t& xattrs)
|
||||
{
|
||||
for(xattrs_t::iterator iter = xattrs.begin(); iter != xattrs.end(); xattrs.erase(iter++)){
|
||||
for(xattrs_t::iterator iter = xattrs.begin(); iter != xattrs.end(); ++iter){
|
||||
delete iter->second;
|
||||
}
|
||||
xattrs.clear();
|
||||
}
|
||||
|
||||
static bool parse_xattr_keyval(const std::string& xattrpair, string& key, PXATTRVAL& pval)
|
||||
|
Loading…
Reference in New Issue
Block a user