Staging
v0.8.1
Revision e2c1657dff86decf1e232b66e766d2e51381109c authored by Miss Islington (bot) on 05 September 2018, 14:45:08 UTC, committed by Victor Stinner on 05 September 2018, 14:45:08 UTC
distutils.spawn.find_executable() now falls back on os.defpath if the
PATH environment variable is not set.
(cherry picked from commit 39487196c87e28128ea907a0d9b8a88ba53f68d5)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent 635461f
Raw File
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