Staging
v0.5.1
https://github.com/python/cpython
Revision 6b6756f1283a87091c6186e70b544d4789e12c51 authored by Miss Islington (bot) on 14 March 2020, 22:17:10 UTC, committed by GitHub on 14 March 2020, 22:17:10 UTC
(cherry picked from commit e5e56328afac50aad6d8893185d8e7ba8928afe2)

Co-authored-by: Antoine <43954001+awecx@users.noreply.github.com>
1 parent cebe9ee
Raw File
Tip revision: 6b6756f1283a87091c6186e70b544d4789e12c51 authored by Miss Islington (bot) on 14 March 2020, 22:17:10 UTC
bpo-39869: Fix typo in 'Instance objects' section. (GH-18889) (GH-18898)
Tip revision: 6b6756f
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