Merge pull request #330 from Dmitry-Me/avoidUnneededPrinterCreation

Avoid unneeded printer object creation
This commit is contained in:
Lee Thomason 2015-05-19 09:31:41 -07:00
commit 1bf04fd755

View File

@ -1928,12 +1928,14 @@ XMLError XMLDocument::Parse( const char* p, size_t len )
void XMLDocument::Print( XMLPrinter* streamer ) const void XMLDocument::Print( XMLPrinter* streamer ) const
{ {
XMLPrinter stdStreamer( stdout ); if ( streamer ) {
if ( !streamer ) {
streamer = &stdStreamer;
}
Accept( streamer ); Accept( streamer );
} }
else {
XMLPrinter stdoutStreamer( stdout );
Accept( &stdoutStreamer );
}
}
void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 ) void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 )