Staging
v0.5.1
https://github.com/python/cpython
Revision efeb9da4ae97861101a7582f8eafdaf836e82cd7 authored by Gregory P. Smith on 14 April 2014, 20:31:21 UTC, committed by Gregory P. Smith on 14 April 2014, 20:31:21 UTC
Fixes issue20307.  No Misc/NEWS entry because frankly this is an
esoteric platform for anyone to be figuring out how to cross compile
CPython for.
1 parent 01bafdc
Raw File
Tip revision: efeb9da4ae97861101a7582f8eafdaf836e82cd7 authored by Gregory P. Smith on 14 April 2014, 20:31:21 UTC
Add conditional code for android's lack of definition of SYS_getdent64.
Tip revision: efeb9da
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