Explorar el Código

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

Bill Hoffman hace 17 años
padre
commit
0143b83264
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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;