Optimize SourceFile::ReadInclude

svn path=/branches/xmlbuildsystem/; revision=15433
This commit is contained in:
Casper Hornstrup 2005-05-20 14:55:15 +00:00
parent 083a71c9f2
commit 892a2cc592

View file

@ -94,6 +94,8 @@ SourceFile::ReadInclude ( string& filename,
bool include = false;
p++;
SkipWhitespace ();
if ( *p == 'i' )
{
if ( strncmp ( p, "include ", 8 ) == 0 )
{
p += 8;
@ -110,18 +112,29 @@ SourceFile::ReadInclude ( string& filename,
if ( include )
{
SkipWhitespace ();
if ( p < end && *p == '<' || *p == '"' )
if ( p < end )
{
register char ch = *p;
if ( ch == '<' || ch == '"' )
{
p++;
filename.resize ( MAX_PATH );
int i = 0;
while ( p < end && *p != '>' && *p != '"' && *p != '\n' )
filename[i++] = *p++;
ch = *p;
while ( p < end && ch != '>' && ch != '"' && ch != '\n' )
{
filename[i++] = *p;
p++;
if ( p < end )
ch = *p;
}
filename.resize ( i );
return true;
}
}
}
}
}
p++;
}
filename = "";