mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
core: drop unnecessary duplicate check
This commit is contained in:
parent
1822e85f4a
commit
03edddba47
@ -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
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user