core: drop unnecessary duplicate check
authorAlexander Alekhin <alexander.alekhin@intel.com>
Fri, 1 Jun 2018 09:31:48 +0000 (12:31 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Fri, 1 Jun 2018 09:31:48 +0000 (12:31 +0300)
modules/core/include/opencv2/core/cvstd.inl.hpp

index f1637c4..631fe94 100644 (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;
 }