Back to index

python3.2  3.2.2
Functions
pystrcmp.c File Reference
#include "Python.h"

Go to the source code of this file.

Functions

int PyOS_mystrnicmp (const char *s1, const char *s2, Py_ssize_t size)
int PyOS_mystricmp (const char *s1, const char *s2)

Function Documentation

int PyOS_mystricmp ( const char *  s1,
const char *  s2 
)

Definition at line 20 of file pystrcmp.c.

{
    while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
        ;
    }
    return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
}
int PyOS_mystrnicmp ( const char *  s1,
const char *  s2,
Py_ssize_t  size 
)

Definition at line 7 of file pystrcmp.c.

{
    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);
}