Fix issue number in comment.
[python.git] / Python / pystrcmp.c
blob84295e7d21feb82f9b7b2870eb9724083c146d6f
1 /* Cross platform case insensitive string compare functions
2 */
4 #include "Python.h"
6 int
7 PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
9 if (size == 0)
10 return 0;
11 while ((--size > 0) &&
12 (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
13 if (!*s1++ || !*s2++)
14 break;
16 return tolower((unsigned)*s1) - tolower((unsigned)*s2);
19 int
20 PyOS_mystricmp(const char *s1, const char *s2)
22 while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
25 return (tolower((unsigned)*s1) - tolower((unsigned)*s2));