]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | /* Cross platform case insensitive string compare functions\r |
2 | */\r | |
3 | \r | |
4 | #include "Python.h"\r | |
5 | \r | |
6 | int\r | |
7 | PyOS_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 | |
19 | int\r | |
20 | PyOS_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 |