mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-03 13:07:24 +00:00
Use pass-by-value for peeloff (#2578)
This avoids copies when used with std::move.
This commit is contained in:
parent
3b226ed672
commit
b87a8400e3
@ -4406,7 +4406,7 @@ bool S3fsCurl::CopyMultipartPostComplete()
|
||||
{
|
||||
std::string etag;
|
||||
partdata.uploaded = simple_parse_xml(bodydata.c_str(), bodydata.size(), "ETag", etag);
|
||||
partdata.petag->etag = peeloff(etag);
|
||||
partdata.petag->etag = peeloff(std::move(etag));
|
||||
|
||||
bodydata.clear();
|
||||
headdata.clear();
|
||||
|
@ -125,12 +125,14 @@ std::string trim(std::string s, const char *t /* = SPACES */)
|
||||
return trim_left(trim_right(std::move(s), t), t);
|
||||
}
|
||||
|
||||
std::string peeloff(const std::string& s)
|
||||
std::string peeloff(std::string s)
|
||||
{
|
||||
if(s.size() < 2 || *s.cbegin() != '"' || *s.rbegin() != '"'){
|
||||
return s;
|
||||
}
|
||||
return s.substr(1, s.size() - 2);
|
||||
s.erase(s.size() - 1);
|
||||
s.erase(0, 1);
|
||||
return s;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -80,7 +80,7 @@ std::string trim_left(std::string s, const char *t = SPACES);
|
||||
std::string trim_right(std::string s, const char *t = SPACES);
|
||||
std::string trim(std::string s, const char *t = SPACES);
|
||||
std::string lower(std::string s);
|
||||
std::string peeloff(const std::string& s);
|
||||
std::string peeloff(std::string s);
|
||||
|
||||
//
|
||||
// Date string
|
||||
|
Loading…
Reference in New Issue
Block a user