Staging
v0.5.1
https://github.com/python/cpython
Revision a881971473d4aedc2160b12e39dbd6db52128810 authored by Senthil Kumaran on 08 November 2010, 02:00:07 UTC, committed by Senthil Kumaran on 08 November 2010, 02:00:07 UTC
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86310 | senthil.kumaran | 2010-11-08 09:53:13 +0800 (Mon, 08 Nov 2010) | 3 lines

  Fix Issue 10303: a small clarification in the tutorial.
........
1 parent 43d8cd8
Raw File
Tip revision: a881971473d4aedc2160b12e39dbd6db52128810 authored by Senthil Kumaran on 08 November 2010, 02:00:07 UTC
Merged revisions 86310 via svnmerge from
Tip revision: a881971
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