]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.10/Python/pystrcmp.c
AppPkg/Applications/Python/Python-2.7.10: Initial Checkin part 1/5.
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Python / pystrcmp.c
CommitLineData
c8042e10
DM
1/* Cross platform case insensitive string compare functions\r
2 */\r
3\r
4#include "Python.h"\r
5\r
6int\r
7PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)\r
8{\r
9 if (size == 0)\r
10 return 0;\r
11 while ((--size > 0) &&\r
12 (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {\r
13 if (!*s1++ || !*s2++)\r
14 break;\r
15 }\r
16 return tolower((unsigned)*s1) - tolower((unsigned)*s2);\r
17}\r
18\r
19int\r
20PyOS_mystricmp(const char *s1, const char *s2)\r
21{\r
22 while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {\r
23 ;\r
24 }\r
25 return (tolower((unsigned)*s1) - tolower((unsigned)*s2));\r
26}\r