Staging
v0.8.1
https://github.com/python/cpython
Revision 0230e64d2c976ab755c145e97bf86032e0fe3a53 authored by Mariatta on 14 February 2017, 14:11:12 UTC, committed by GitHub on 14 February 2017, 14:11:12 UTC
various updates from upstream python/typing repo:

- Added typing.Counter and typing.ChainMap generics
- More flexible typing.NamedTuple
- Improved generic ABC caching
- More tests
- Bugfixes
- Other updates
* Add Misc/NEWS entry


(cherry picked from commit b692dc8475a032740576129d0990ddc3edccab2b)
1 parent 2d0c228
Raw File
Tip revision: 0230e64d2c976ab755c145e97bf86032e0fe3a53 authored by Mariatta on 14 February 2017, 14:11:12 UTC
bpo-28556: Various updates to typing (#28) (#77)
Tip revision: 0230e64
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