diff options
author | koekeishiya <aasvi93@hotmail.com> | 2017-08-24 13:40:46 +0200 |
---|---|---|
committer | koekeishiya <aasvi93@hotmail.com> | 2017-08-24 13:40:46 +0200 |
commit | d6bcc6167b79814171071406161a3f5d57a8cf42 (patch) | |
tree | bf958374c3d190dc0c647c72a59a918d7b92ef33 /src/tokenize.c | |
parent | b9040ee1b687b3d8407e0009be16374d3556ddef (diff) | |
download | skhd-d6bcc6167b79814171071406161a3f5d57a8cf42.tar.gz skhd-d6bcc6167b79814171071406161a3f5d57a8cf42.zip |
#2 get rid of strncmp
Diffstat (limited to 'src/tokenize.c')
-rw-r--r-- | src/tokenize.c | 9 |
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 |