Optimisation: Optimised firstWordEquals

This commit is contained in:
Daniel Marjamäki 2010-08-08 18:54:49 +02:00
parent 5a8181d425
commit 1d79c164c4
1 changed files with 5 additions and 3 deletions

View File

@ -296,11 +296,13 @@ bool Token::simpleMatch(const Token *tok, const char pattern[])
int Token::firstWordEquals(const char *str, const char *word) int Token::firstWordEquals(const char *str, const char *word)
{ {
for (;;) for (;;)
{
if (*str != *word)
{ {
if (*str == ' ' && *word == 0) if (*str == ' ' && *word == 0)
return 0; return 0;
else if (*str != *word)
return 1; return 1;
}
else if (*str == 0) else if (*str == 0)
break; break;