Simplify ParseName

Only the first char needs to be checked with IsNameStartChar, so check
it before the loop.
This commit is contained in:
JayXon 2014-12-24 04:01:42 -05:00
parent 69242c4b9b
commit ee525dba4d
1 changed files with 7 additions and 7 deletions

View File

@ -140,18 +140,18 @@ char* StrPair::ParseName( char* p )
if ( !p || !(*p) ) {
return 0;
}
if ( !XMLUtil::IsNameStartChar( *p ) ) {
return 0;
}
char* const start = p;
while( *p && ( p == start ? XMLUtil::IsNameStartChar( *p ) : XMLUtil::IsNameChar( *p ) )) {
++p;
while ( *p && XMLUtil::IsNameChar( *p ) ) {
++p;
}
if ( p > start ) {
Set( start, p, 0 );
return p;
}
return 0;
Set( start, p, 0 );
return p;
}