getopt: fix null pointer arithmetic ub
[musl] / src / string / strcasecmp.c
1 #include <strings.h>
2 #include <ctype.h>
3
4 int strcasecmp(const char *_l, const char *_r)
5 {
6         const unsigned char *l=(void *)_l, *r=(void *)_r;
7         for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
8         return tolower(*l) - tolower(*r);
9 }
10
11 int __strcasecmp_l(const char *l, const char *r, locale_t loc)
12 {
13         return strcasecmp(l, r);
14 }
15
16 weak_alias(__strcasecmp_l, strcasecmp_l);