Merge pull request #11654 from alalek:issue_11648

This commit is contained in:
Vadim Pisarevsky 2018-06-04 10:22:44 +00:00
commit ccbc0b91ea

View File

@ -77,11 +77,8 @@ inline
String::String(const std::string& str)
: 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
@ -99,11 +96,8 @@ inline
String& String::operator = (const std::string& str)
{
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;
}