mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Merged revisions 72040 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72040 | eric.smith | 2009-04-27 15:04:37 -0400 (Mon, 27 Apr 2009) | 1 line Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors. ........
This commit is contained in:
parent
249b898ec7
commit
6dc46f5eaa
13 changed files with 96 additions and 294 deletions
|
|
@ -2176,16 +2176,16 @@ split_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxcount)
|
|||
|
||||
for (i = j = 0; i < len; ) {
|
||||
/* find a token */
|
||||
while (i < len && ISSPACE(s[i]))
|
||||
while (i < len && Py_ISSPACE(s[i]))
|
||||
i++;
|
||||
j = i;
|
||||
while (i < len && !ISSPACE(s[i]))
|
||||
while (i < len && !Py_ISSPACE(s[i]))
|
||||
i++;
|
||||
if (j < i) {
|
||||
if (maxcount-- <= 0)
|
||||
break;
|
||||
SPLIT_ADD(s, j, i);
|
||||
while (i < len && ISSPACE(s[i]))
|
||||
while (i < len && Py_ISSPACE(s[i]))
|
||||
i++;
|
||||
j = i;
|
||||
}
|
||||
|
|
@ -2410,16 +2410,16 @@ rsplit_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxcount)
|
|||
|
||||
for (i = j = len - 1; i >= 0; ) {
|
||||
/* find a token */
|
||||
while (i >= 0 && ISSPACE(s[i]))
|
||||
while (i >= 0 && Py_ISSPACE(s[i]))
|
||||
i--;
|
||||
j = i;
|
||||
while (i >= 0 && !ISSPACE(s[i]))
|
||||
while (i >= 0 && !Py_ISSPACE(s[i]))
|
||||
i--;
|
||||
if (j > i) {
|
||||
if (maxcount-- <= 0)
|
||||
break;
|
||||
SPLIT_ADD(s, i + 1, j + 1);
|
||||
while (i >= 0 && ISSPACE(s[i]))
|
||||
while (i >= 0 && Py_ISSPACE(s[i]))
|
||||
i--;
|
||||
j = i;
|
||||
}
|
||||
|
|
@ -2986,11 +2986,11 @@ hex_digit_to_int(Py_UNICODE c)
|
|||
{
|
||||
if (c >= 128)
|
||||
return -1;
|
||||
if (ISDIGIT(c))
|
||||
if (Py_ISDIGIT(c))
|
||||
return c - '0';
|
||||
else {
|
||||
if (ISUPPER(c))
|
||||
c = TOLOWER(c);
|
||||
if (Py_ISUPPER(c))
|
||||
c = Py_TOLOWER(c);
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue