aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2017-08-24 13:40:46 +0200
committerkoekeishiya <aasvi93@hotmail.com>2017-08-24 13:40:46 +0200
commitd6bcc6167b79814171071406161a3f5d57a8cf42 (patch)
treebf958374c3d190dc0c647c72a59a918d7b92ef33 /src/parse.c
parentb9040ee1b687b3d8407e0009be16374d3556ddef (diff)
downloadskhd-d6bcc6167b79814171071406161a3f5d57a8cf42.tar.gz
skhd-d6bcc6167b79814171071406161a3f5d57a8cf42.zip
#2 get rid of strncmp
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/parse.c b/src/parse.c
index 0ec0209..b279ead 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -32,12 +32,6 @@ read_file(const char *file)
return buffer;
}
-internal inline bool
-same_string(char *text, unsigned length, const char *match)
-{
- return strncmp(text, match, length) == 0;
-}
-
internal char *
copy_string_count(char *s, int length)
{
@@ -109,7 +103,7 @@ parse_key_literal(struct parser *parser)
// NOTE(koekeishiya): Might want to replace this mapping with a hashtable
for(int i = 0; i < array_count(literal_keycode_str); ++i) {
- if(same_string(key.text, key.length, literal_keycode_str[i])) {
+ if(token_equals(key, literal_keycode_str[i])) {
keycode = literal_keycode_value[i];
printf("\tkey: '%.*s' (0x%02x)\n", key.length, key.text, keycode);
break;
@@ -135,7 +129,7 @@ parse_modifier(struct parser *parser)
// NOTE(koekeishiya): Might want to replace this mapping with a hashtable
for(int i = 0; i < array_count(modifier_flags_str); ++i) {
- if(same_string(modifier.text, modifier.length, modifier_flags_str[i])) {
+ if(token_equals(modifier, modifier_flags_str[i])) {
flags |= modifier_flags_value[i];
printf("\tmod: '%s'\n", modifier_flags_str[i]);
break;