Unify SkipWhiteSpace()/ReadBOM() calls, add asserts
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 7b975c9..af27418 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -162,7 +162,7 @@
     // Trim leading space.

     _start = XMLUtil::SkipWhiteSpace( _start );

 

-    if ( _start && *_start ) {

+    if ( *_start ) {

         char* p = _start;	// the read pointer

         char* q = _start;	// the write pointer

 

@@ -277,6 +277,8 @@
 

 const char* XMLUtil::ReadBOM( const char* p, bool* bom )

 {

+    TIXMLASSERT( p );

+    TIXMLASSERT( bom );

     *bom = false;

     const unsigned char* pu = reinterpret_cast<const unsigned char*>(p);

     // Check for BOM:

@@ -286,6 +288,7 @@
         *bom = true;

         p += 3;

     }

+    TIXMLASSERT( p );

     return p;

 }

 

@@ -505,7 +508,7 @@
 {

     char* const start = p;

     p = XMLUtil::SkipWhiteSpace( p );

-    if( !p || !*p ) {

+    if( !*p ) {

         return p;

     }

 

@@ -641,6 +644,7 @@
 

 void XMLNode::Unlink( XMLNode* child )

 {

+    TIXMLASSERT( child );

     TIXMLASSERT( child->_document == _document );

     if ( child == _firstChild ) {

         _firstChild = _firstChild->_next;

@@ -661,6 +665,7 @@
 

 void XMLNode::DeleteChild( XMLNode* node )

 {

+    TIXMLASSERT( node );

     TIXMLASSERT( node->_document == _document );

     TIXMLASSERT( node->_parent == this );

     DeleteNode( node );

@@ -1132,7 +1137,7 @@
 

     // Skip white space before =

     p = XMLUtil::SkipWhiteSpace( p );

-    if ( !p || *p != '=' ) {

+    if ( *p != '=' ) {

         return 0;

     }

 

@@ -1468,7 +1473,7 @@
     // Read the attributes.

     while( p ) {

         p = XMLUtil::SkipWhiteSpace( p );

-        if ( !p || !(*p) ) {

+        if ( !(*p) ) {

             _document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() );

             return 0;

         }

@@ -1535,9 +1540,6 @@
 {

     // Read the element name.

     p = XMLUtil::SkipWhiteSpace( p );

-    if ( !p ) {

-        return 0;

-    }

 

     // The closing element is the </element> form. It is

     // parsed just like a regular element then deleted from

@@ -1828,7 +1830,7 @@
     const char* p = _charBuffer;

     p = XMLUtil::SkipWhiteSpace( p );

     p = XMLUtil::ReadBOM( p, &_writeBOM );

-    if ( !p || !*p ) {

+    if ( !*p ) {

         SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );

         return _errorID;

     }

@@ -1877,7 +1879,7 @@
     const char* start = p;

     p = XMLUtil::SkipWhiteSpace( p );

     p = XMLUtil::ReadBOM( p, &_writeBOM );

-    if ( !p || !*p ) {

+    if ( !*p ) {

         SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 );

         return _errorID;

     }