ยปCore Development>Code coverage>Python/pystrcmp.c

Python code coverage for Python/pystrcmp.c

#countcontent
1n/a/* Cross platform case insensitive string compare functions
2n/a */
3n/a
4n/a#include "Python.h"
5n/a
6n/aint
7n/aPyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
8n/a{
9n/a if (size == 0)
10n/a return 0;
11n/a while ((--size > 0) &&
12n/a (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
13n/a if (!*s1++ || !*s2++)
14n/a break;
15n/a }
16n/a return tolower((unsigned)*s1) - tolower((unsigned)*s2);
17n/a}
18n/a
19n/aint
20n/aPyOS_mystricmp(const char *s1, const char *s2)
21n/a{
22n/a while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
23n/a ;
24n/a }
25n/a return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
26n/a}