aboutsummaryrefslogtreecommitdiff
path: root/src/tokenize.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenize.c')
-rw-r--r--src/tokenize.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tokenize.c b/src/tokenize.c
index 5f83084..822bc70 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -7,9 +7,12 @@ internal int
token_equals(struct token token, const char *match)
{
const char *at = match;
- unsigned index = 0;
- while(*at++ == token.text[index++] && index < token.length);
- return (*at == '\0' && index == token.length) ? 1 : 0;
+ for(int i = 0; i < token.length; ++i, ++at) {
+ if((*at == 0) || (token.text[i] != *at)) {
+ return false;
+ }
+ }
+ return (*at == 0);
}
internal void