comparison Python/pystrcmp.c @ 61467:f197407bdba2 3.1

Recorded merge of revisions 81032 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
author Antoine Pitrou <solipsis@pitrou.net>
date Sun, 09 May 2010 16:14:21 +0000
parents 0a485593ae1c
children
comparison
equal deleted inserted replaced
61459:f8c19c5f5dd2 61467:f197407bdba2
4 #include "Python.h" 4 #include "Python.h"
5 5
6 int 6 int
7 PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size) 7 PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
8 { 8 {
9 if (size == 0) 9 if (size == 0)
10 return 0; 10 return 0;
11 while ((--size > 0) && 11 while ((--size > 0) &&
12 (tolower((unsigned)*s1) == tolower((unsigned)*s2))) { 12 (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
13 if (!*s1++ || !*s2++) 13 if (!*s1++ || !*s2++)
14 break; 14 break;
15 } 15 }
16 return tolower((unsigned)*s1) - tolower((unsigned)*s2); 16 return tolower((unsigned)*s1) - tolower((unsigned)*s2);
17 } 17 }
18 18
19 int 19 int
20 PyOS_mystricmp(const char *s1, const char *s2) 20 PyOS_mystricmp(const char *s1, const char *s2)
21 { 21 {
22 while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) { 22 while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
23 ; 23 ;
24 } 24 }
25 return (tolower((unsigned)*s1) - tolower((unsigned)*s2)); 25 return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
26 } 26 }