slightly cleaner strlen, also seems to compile to better code
[musl] / src / string / strncasecmp.c
1 #include <strings.h>
2 #include <ctype.h>
3
4 int strncasecmp(const char *_l, const char *_r, size_t n)
5 {
6         const unsigned char *l=(void *)_l, *r=(void *)_r;
7         if (!n--) return 0;
8         for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--);
9         return tolower(*l) - tolower(*r);
10 }