Merge pull request #593 from Dmitry-Me/testDeletionViaDocument
Test nodes deletion via document
diff --git a/tinyxml2.h b/tinyxml2.h
index e6a0ced..a372b41 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -341,8 +341,8 @@
void Clear() {
// Delete the blocks.
while( !_blockPtrs.Empty()) {
- Block* b = _blockPtrs.Pop();
- delete b;
+ Block* lastBlock = _blockPtrs.Pop();
+ delete lastBlock;
}
_root = 0;
_currentAllocs = 0;
diff --git a/xmltest.cpp b/xmltest.cpp
index 08af615..3fada04 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -2130,13 +2130,15 @@
#endif
#if defined( _MSC_VER )
- printf("\nParsing %s of dream.xml: %.3f milli-seconds\n", note, 1000.0 * (double)(end - start) / ((double)freq * (double)COUNT));
+ const double duration = 1000.0 * (double)(end - start) / ((double)freq * (double)COUNT);
#else
- printf("\nParsing %s of dream.xml: %.3f milli-seconds\n", note, (double)(cend - cstart) / (double)COUNT);
+ const double duration = (double)(cend - cstart) / (double)COUNT;
#endif
+ printf("\nParsing dream.xml (%s): %.3f milli-seconds\n", note, duration);
}
- #if defined( _MSC_VER ) && defined( DEBUG )
+#if defined( _MSC_VER ) && defined( DEBUG )
+ {
_CrtMemCheckpoint( &endMemState );
_CrtMemState diffMemState;
@@ -2147,7 +2149,8 @@
int leaksBeforeExit = _CrtDumpMemoryLeaks();
XMLTest( "No leaks before exit?", FALSE, leaksBeforeExit );
}
- #endif
+ }
+#endif
printf ("\nPass %d, Fail %d\n", gPass, gFail);