Staging
v0.5.1
https://github.com/python/cpython
Revision 21ce8f0d662df360e7a65a544309563fecd67f08 authored by Antoine Pitrou on 07 May 2011, 17:59:33 UTC, committed by Antoine Pitrou on 07 May 2011, 17:59:33 UTC
1 parent 0639be6
Raw File
Tip revision: 21ce8f0d662df360e7a65a544309563fecd67f08 authored by Antoine Pitrou on 07 May 2011, 17:59:33 UTC
Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch by Kasun Herath.
Tip revision: 21ce8f0
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