Staging
v0.5.1
https://github.com/python/cpython
Revision 2eb1dac46e256e7f9be71021e4630c0a3e9b4b03 authored by Miss Islington (bot) on 01 October 2019, 01:47:13 UTC, committed by Yury Selivanov on 01 October 2019, 01:47:13 UTC
(cherry picked from commit e407013089259e4c0b271703e1975bbcd578a2d5)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
1 parent 1c3e469
Raw File
Tip revision: 2eb1dac46e256e7f9be71021e4630c0a3e9b4b03 authored by Miss Islington (bot) on 01 October 2019, 01:47:13 UTC
Fix and improve `asyncio.run()` docs (GH-16403) (GH-16505)
Tip revision: 2eb1dac
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