From 3ae4f3eb3c1fdd9fdc5385e59d1cebe0e99318b5 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Fri, 9 Jan 2015 15:44:16 +0300 Subject: [PATCH] Get rid of repeated comparisons --- tinyxml2.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 14cc91a..e5c0405 100755 --- a/tinyxml2.cpp +++ b/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; + if ( endTag.Empty() ) { + if ( ele->ClosingType() == XMLElement::OPEN ) { + mismatch = true; + } } - else if ( !endTag.Empty() && 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; } }