Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Python/pystrcmp.c
Line
Count
Source (jump to first uncovered line)
1
/* Cross platform case insensitive string compare functions
2
 */
3
4
#include "Python.h"
5
6
int
7
PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
8
{
9
    const unsigned char *p1, *p2;
10
    if (size == 0)
  Branch (10:9): [True: 0, False: 5.19k]
11
        return 0;
12
    p1 = (const unsigned char *)s1;
13
    p2 = (const unsigned char *)s2;
14
    for (; (--size > 0) && 
*p16.49k
&&
*p26.49k
&&
(tolower(*p1) == tolower(*p2))6.49k
;
  Branch (14:12): [True: 6.49k, False: 322]
  Branch (14:28): [True: 6.49k, False: 0]
  Branch (14:35): [True: 6.49k, False: 0]
  Branch (14:42): [True: 1.61k, False: 4.87k]
15
         
p1++, p2++1.61k
) {
16
        ;
17
    }
18
    return tolower(*p1) - tolower(*p2);
19
}
20
21
int
22
PyOS_mystricmp(const char *s1, const char *s2)
23
{
24
    const unsigned char *p1 = (const unsigned char *)s1;
25
    const unsigned char *p2 = (const unsigned char *)s2;
26
    for (; *p1 && *p2 && (tolower(*p1) == tolower(*p2)); p1++, p2++) {
  Branch (26:12): [True: 0, False: 0]
  Branch (26:19): [True: 0, False: 0]
  Branch (26:26): [True: 0, False: 0]
27
        ;
28
    }
29
    return (tolower(*p1) - tolower(*p2));
30
}