Browse Source

COMP: remove warning and check for assignment to itself in operator=

Bill Hoffman 17 năm trước cách đây
mục cha
commit
0143b83264
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      Source/kwsys/RegularExpression.cxx

+ 4 - 0
Source/kwsys/RegularExpression.cxx

@@ -77,6 +77,10 @@ RegularExpression::RegularExpression (const RegularExpression& rxp) {
 // operator= -- Copies the given regular expression.
 RegularExpression& RegularExpression::operator= (const RegularExpression& rxp)
 {
+  if(this == &rxp)
+    {
+    return *this;
+    }
   if ( !rxp.program )
     {
     this->program = 0;