Commit 4ed68120dea2eb85548b3e571b472fe7454b3227

Ran Benita 2014-10-01T19:14:36

scanner-utils: optimize str()/lit() Replace the dog-slow unneeded strncasecmp() with an inlineable memcmp(). Before: compiled 2500 keymaps in 8.348715629s After: compiled 2500 keymaps in 7.872640338s Signed-off-by: Ran Benita <ran234@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/scanner-utils.h b/src/scanner-utils.h
index e4e90eb..fc231ab 100644
--- a/src/scanner-utils.h
+++ b/src/scanner-utils.h
@@ -130,7 +130,7 @@ str(struct scanner *s, const char *string, size_t len)
 {
     if (s->len - s->pos < len)
         return false;
-    if (strncasecmp(s->s + s->pos, string, len) != 0)
+    if (memcmp(s->s + s->pos, string, len) != 0)
         return false;
     s->pos += len; s->column += len;
     return true;