Staging
v0.8.1
v0.8.1
Revision 08045391a7aa87d4fbd3e8ef4c852c2fa4e81a8a authored by Miss Islington (bot) on 22 August 2020, 19:15:29 UTC, committed by GitHub on 22 August 2020, 19:15:29 UTC
(cherry picked from commit 802726acf6048338394a6a4750835c2cdd6a947b) Co-authored-by: Andre Delfino <adelfino@gmail.com>
1 parent e94d5db
pystrcmp.c
/* Cross platform case insensitive string compare functions
*/
#include "Python.h"
int
PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
{
if (size == 0)
return 0;
while ((--size > 0) &&
(tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
if (!*s1++ || !*s2++)
break;
}
return tolower((unsigned)*s1) - tolower((unsigned)*s2);
}
int
PyOS_mystricmp(const char *s1, const char *s2)
{
while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
;
}
return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
}
Computing file changes ...