mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-03 13:07:24 +00:00
Remove unnecessary calls to std::string::c_str
Found via clang-tidy.
This commit is contained in:
parent
25b49e1a2e
commit
508fafbe62
@ -231,11 +231,11 @@ bool StatCache::GetStat(string& key, struct stat* pst, headers_t* meta, bool ove
|
|||||||
stat_cache_t::iterator iter = stat_cache.end();
|
stat_cache_t::iterator iter = stat_cache.end();
|
||||||
if(overcheck && '/' != strpath[strpath.length() - 1]){
|
if(overcheck && '/' != strpath[strpath.length() - 1]){
|
||||||
strpath += "/";
|
strpath += "/";
|
||||||
iter = stat_cache.find(strpath.c_str());
|
iter = stat_cache.find(strpath);
|
||||||
}
|
}
|
||||||
if(iter == stat_cache.end()){
|
if(iter == stat_cache.end()){
|
||||||
strpath = key;
|
strpath = key;
|
||||||
iter = stat_cache.find(strpath.c_str());
|
iter = stat_cache.find(strpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iter != stat_cache.end() && (*iter).second){
|
if(iter != stat_cache.end() && (*iter).second){
|
||||||
@ -320,11 +320,11 @@ bool StatCache::IsNoObjectCache(string& key, bool overcheck)
|
|||||||
stat_cache_t::iterator iter = stat_cache.end();
|
stat_cache_t::iterator iter = stat_cache.end();
|
||||||
if(overcheck && '/' != strpath[strpath.length() - 1]){
|
if(overcheck && '/' != strpath[strpath.length() - 1]){
|
||||||
strpath += "/";
|
strpath += "/";
|
||||||
iter = stat_cache.find(strpath.c_str());
|
iter = stat_cache.find(strpath);
|
||||||
}
|
}
|
||||||
if(iter == stat_cache.end()){
|
if(iter == stat_cache.end()){
|
||||||
strpath = key;
|
strpath = key;
|
||||||
iter = stat_cache.find(strpath.c_str());
|
iter = stat_cache.find(strpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iter != stat_cache.end() && (*iter).second) {
|
if(iter != stat_cache.end() && (*iter).second) {
|
||||||
@ -582,7 +582,7 @@ bool StatCache::DelStat(const char* key)
|
|||||||
// If there is "path/" cache, delete it.
|
// If there is "path/" cache, delete it.
|
||||||
strpath += "/";
|
strpath += "/";
|
||||||
}
|
}
|
||||||
if(stat_cache.end() != (iter = stat_cache.find(strpath.c_str()))){
|
if(stat_cache.end() != (iter = stat_cache.find(strpath))){
|
||||||
if((*iter).second){
|
if((*iter).second){
|
||||||
delete (*iter).second;
|
delete (*iter).second;
|
||||||
}
|
}
|
||||||
|
@ -4341,10 +4341,10 @@ string prepare_url(const char* url)
|
|||||||
uri = url_str.substr(0, uri_length);
|
uri = url_str.substr(0, uri_length);
|
||||||
|
|
||||||
if(!pathrequeststyle){
|
if(!pathrequeststyle){
|
||||||
hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length).c_str();
|
hostname = bucket + "." + url_str.substr(uri_length, bucket_pos - uri_length);
|
||||||
path = url_str.substr((bucket_pos + bucket_length));
|
path = url_str.substr((bucket_pos + bucket_length));
|
||||||
}else{
|
}else{
|
||||||
hostname = url_str.substr(uri_length, bucket_pos - uri_length).c_str();
|
hostname = url_str.substr(uri_length, bucket_pos - uri_length);
|
||||||
string part = url_str.substr((bucket_pos + bucket_length));
|
string part = url_str.substr((bucket_pos + bucket_length));
|
||||||
if('/' != part[0]){
|
if('/' != part[0]){
|
||||||
part = "/" + part;
|
part = "/" + part;
|
||||||
|
Loading…
Reference in New Issue
Block a user