Procházet zdrojové kódy

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

Bill Hoffman před 17 roky
rodič
revize
0143b83264
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  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;