Staging
v0.5.1
https://github.com/python/cpython
Revision 9684cf69e32ae442c7be54521073ac78557f3bbf authored by Miss Islington (bot) on 07 November 2017, 00:44:23 UTC, committed by Victor Stinner on 07 November 2017, 00:44:23 UTC
1 parent a6ffec2
Raw File
Tip revision: 9684cf69e32ae442c7be54521073ac78557f3bbf authored by Miss Islington (bot) on 07 November 2017, 00:44:23 UTC
bpo-31770: Prevent a crash and refleaks when calling sqlite3.Cursor.__init__() more than once (GH-3968) (#4301)
Tip revision: 9684cf6
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