Mercurial > cpython-lru_cache-weakref
comparison Python/pystrcmp.c @ 61465:e38335d4df91 2.6
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 15:15:40 +0000 |
| parents | 0a485593ae1c |
| children |
comparison
equal
deleted
inserted
replaced
| 61461:b6e03ca8a206 | 61465:e38335d4df91 |
|---|---|
| 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 } |
