source: python/vendor/current/Python/pystrcmp.c

Last change on this file was 388, checked in by dmik, 11 years ago

python: Update vendor to 2.7.6.

  • Property svn:eol-style set to native
File size: 613 bytes
Line 
1/* Cross platform case insensitive string compare functions
2 */
3
4#include "Python.h"
5
6int
7PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
8{
9 if (size == 0)
10 return 0;
11 while ((--size > 0) &&
12 (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
13 if (!*s1++ || !*s2++)
14 break;
15 }
16 return tolower((unsigned)*s1) - tolower((unsigned)*s2);
17}
18
19int
20PyOS_mystricmp(const char *s1, const char *s2)
21{
22 while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
23 ;
24 }
25 return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
26}
Note: See TracBrowser for help on using the repository browser.