mirror of
https://github.com/leethomason/tinyxml2.git
synced 2026-07-21 19:23:00 +04:00
Improved XMLNode::~XMLNode perfomance (#1075)
Improved XMLNode::~XMLNode perfomance (#1075)
This commit is contained in:
+11
-1
@@ -834,7 +834,17 @@ XMLNode::XMLNode( XMLDocument* doc ) :
|
|||||||
|
|
||||||
XMLNode::~XMLNode()
|
XMLNode::~XMLNode()
|
||||||
{
|
{
|
||||||
DeleteChildren();
|
// Fast path: this node is dying, so maintaining _firstChild/_lastChild and
|
||||||
|
// sibling _prev/_next links is unnecessary. Only _parent must be zeroed to
|
||||||
|
// satisfy the MarkInUse assertion inside DeleteNode.
|
||||||
|
XMLNode *currentChild = _firstChild;
|
||||||
|
while (currentChild != NULL) {
|
||||||
|
XMLNode *next = currentChild->_next;
|
||||||
|
currentChild->_parent = 0;
|
||||||
|
DeleteNode(currentChild);
|
||||||
|
currentChild = next;
|
||||||
|
}
|
||||||
|
|
||||||
if ( _parent ) {
|
if ( _parent ) {
|
||||||
_parent->Unlink( this );
|
_parent->Unlink( this );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,14 +42,6 @@ distribution.
|
|||||||
#endif
|
#endif
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/*
|
|
||||||
gcc:
|
|
||||||
g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
|
|
||||||
|
|
||||||
Formatting, Artistic Style:
|
|
||||||
AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined( _DEBUG ) || defined (__DEBUG__)
|
#if defined( _DEBUG ) || defined (__DEBUG__)
|
||||||
# ifndef TINYXML2_DEBUG
|
# ifndef TINYXML2_DEBUG
|
||||||
# define TINYXML2_DEBUG
|
# define TINYXML2_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user