Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,17 @@ XMLNode::XMLNode( XMLDocument* doc ) :

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 ) {
_parent->Unlink( this );
}
Expand Down Expand Up @@ -2348,8 +2358,6 @@ static FILE* callfopen( const char* filepath, const char* mode )
}

void XMLDocument::DeleteNode( XMLNode* node ) {
TIXMLASSERT( node );
TIXMLASSERT(node->_document == this );
if(node == 0) {
return; // check for null pointer
}
Expand Down
8 changes: 0 additions & 8 deletions tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ distribution.
#endif
#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__)
# ifndef TINYXML2_DEBUG
# define TINYXML2_DEBUG
Expand Down
Loading