From c7ab09b0ff77fd680da3a4aae7ae56765144785d Mon Sep 17 00:00:00 2001 From: Platonides Date: Wed, 5 Jun 2013 03:07:42 +0200 Subject: [PATCH] Cleanup Preprocessor_DOM::preprocessToObj wfProfileOut()s Simplify the multiple if levels used for profiling out. Change-Id: Id0530207f99daca49a6a76ce256476b677a4108f --- includes/parser/Preprocessor_DOM.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index dde0609519..3138f48385 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -183,21 +183,21 @@ class Preprocessor_DOM implements Preprocessor { $xml = UtfNormal::cleanUp( $xml ); // 1 << 19 == XML_PARSE_HUGE, needed so newer versions of libxml2 don't barf when the XML is >256 levels deep $result = $dom->loadXML( $xml, 1 << 19 ); - if ( !$result ) { - wfProfileOut( __METHOD__ . '-loadXML' ); - if ( $cacheable ) { - wfProfileOut( __METHOD__ . '-cacheable' ); - } - wfProfileOut( __METHOD__ ); - throw new MWException( __METHOD__ . ' generated invalid XML' ); - } } - $obj = new PPNode_DOM( $dom->documentElement ); + if ( $result ) { + $obj = new PPNode_DOM( $dom->documentElement ); + } wfProfileOut( __METHOD__ . '-loadXML' ); + if ( $cacheable ) { wfProfileOut( __METHOD__ . '-cacheable' ); } + wfProfileOut( __METHOD__ ); + + if ( !$result ) { + throw new MWException( __METHOD__ . ' generated invalid XML' ); + } return $obj; } -- 2.20.1