Staging
v0.5.1
https://github.com/python/cpython
Revision b2c2a0c02c6056dc73311a8a8a295249c454913a authored by Miss Islington (bot) on 27 September 2019, 08:13:38 UTC, committed by GitHub on 27 September 2019, 08:13:38 UTC
(cherry picked from commit 6ce03ec627680ce0829a5b3067fab7faed21b533)

Co-authored-by: HongWeipeng <961365124@qq.com>
1 parent 1931132
Raw File
Tip revision: b2c2a0c02c6056dc73311a8a8a295249c454913a authored by Miss Islington (bot) on 27 September 2019, 08:13:38 UTC
cleanup ababstractproperty in typing.py (GH-16432)
Tip revision: b2c2a0c
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));
}
back to top