瀏覽代碼

Get rid of repeated comparisons

Dmitry-Me 11 年之前
父節點
當前提交
3ae4f3eb3c
共有 1 個文件被更改,包括 9 次插入7 次删除
  1. 9 7
      tinyxml2.cpp

+ 9 - 7
tinyxml2.cpp

@@ -866,14 +866,16 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
             // Handle an end tag returned to this level.
             // And handle a bunch of annoying errors.
             bool mismatch = false;
-            if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) {
-                mismatch = true;
-            }
-            else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) {
-                mismatch = true;
+            if ( endTag.Empty() ) {
+                if ( ele->ClosingType() == XMLElement::OPEN ) {
+                    mismatch = true;
+                }
             }
-            else if ( !endTag.Empty() ) {
-                if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) {
+            else {
+                if ( ele->ClosingType() != XMLElement::OPEN ) {
+                    mismatch = true;
+                }
+                else if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() ) ) {
                     mismatch = true;
                 }
             }