Commit ccbc0b91 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #11654 from alalek:issue_11648

parents 30305946 03edddba
...@@ -77,11 +77,8 @@ inline ...@@ -77,11 +77,8 @@ inline
String::String(const std::string& str) String::String(const std::string& str)
: cstr_(0), len_(0) : cstr_(0), len_(0)
{ {
if (!str.empty()) size_t len = str.size();
{ if (len) memcpy(allocate(len), str.c_str(), len);
size_t len = str.size();
if (len) memcpy(allocate(len), str.c_str(), len);
}
} }
inline inline
...@@ -99,11 +96,8 @@ inline ...@@ -99,11 +96,8 @@ inline
String& String::operator = (const std::string& str) String& String::operator = (const std::string& str)
{ {
deallocate(); deallocate();
if (!str.empty()) size_t len = str.size();
{ if (len) memcpy(allocate(len), str.c_str(), len);
size_t len = str.size();
if (len) memcpy(allocate(len), str.c_str(), len);
}
return *this; return *this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment