Staging
v0.5.1
https://github.com/python/cpython
Revision f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d authored by Shantanu on 06 June 2020, 10:08:48 UTC, committed by GitHub on 06 June 2020, 10:08:48 UTC
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit c116c94ff119485761460f1033cdee425bed0310)
1 parent c067183
Raw File
Tip revision: f7ed4d4e83f5d9e85e244a1cbc460f26436ab24d authored by Shantanu on 06 June 2020, 10:08:48 UTC
bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20466)
Tip revision: f7ed4d4
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