switch to using pointer, not reference

This commit is contained in:
Lee Thomason 2014-11-27 22:31:11 -08:00
parent b2ec17dd5f
commit 2965880447
2 changed files with 11 additions and 11 deletions

View File

@ -70,23 +70,23 @@ StrPair::~StrPair()
} }
void StrPair::TransferTo( StrPair& other ) void StrPair::TransferTo( StrPair* other )
{ {
if ( this == &other ) { if ( this == other ) {
return; return;
} }
// This in effect implements the assignment operator by "moving" // This in effect implements the assignment operator by "moving"
// ownership (as in auto_ptr). // ownership (as in auto_ptr).
TIXMLASSERT( other._flags == 0 ); TIXMLASSERT( other->_flags == 0 );
TIXMLASSERT( other._start == 0 ); TIXMLASSERT( other->_start == 0 );
TIXMLASSERT( other._end == 0 ); TIXMLASSERT( other->_end == 0 );
other.Reset(); other->Reset();
other._flags = _flags; other->_flags = _flags;
other._start = _start; other->_start = _start;
other._end = _end; other->_end = _end;
_flags = 0; _flags = 0;
_start = 0; _start = 0;
@ -847,7 +847,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
// We read the end tag. Return it to the parent. // We read the end tag. Return it to the parent.
if ( ele && ele->ClosingType() == XMLElement::CLOSING ) { if ( ele && ele->ClosingType() == XMLElement::CLOSING ) {
if ( parentEnd ) { if ( parentEnd ) {
ele->_value.TransferTo( *parentEnd ); ele->_value.TransferTo( parentEnd );
} }
node->_memPool->SetTracked(); // created and then immediately deleted. node->_memPool->SetTracked(); // created and then immediately deleted.
DeleteNode( node ); DeleteNode( node );

View File

@ -184,7 +184,7 @@ public:
char* ParseText( char* in, const char* endTag, int strFlags ); char* ParseText( char* in, const char* endTag, int strFlags );
char* ParseName( char* in ); char* ParseName( char* in );
void TransferTo( StrPair& other ); void TransferTo( StrPair* other );
private: private:
void Reset(); void Reset();