summaryrefslogtreecommitdiffstats
path: root/Modules/stropmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-10 17:01:56 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-10 17:01:56 (GMT)
commit7f7f27483996ae9fcb2ed4fb0a3690280cda7b4a (patch)
tree5d67635bbdfd2fe5bb0b055d532c371716c59d91 /Modules/stropmodule.c
parent760dd1031a8db93dc53ae3eb836bcc44a36918a1 (diff)
downloadcpython-7f7f27483996ae9fcb2ed4fb0a3690280cda7b4a.zip
cpython-7f7f27483996ae9fcb2ed4fb0a3690280cda7b4a.tar.gz
cpython-7f7f27483996ae9fcb2ed4fb0a3690280cda7b4a.tar.bz2
use Py_CHARMASK
Diffstat (limited to 'Modules/stropmodule.c')
-rw-r--r--Modules/stropmodule.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index 326dfb8..90ee4fd 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -41,7 +41,6 @@ strop_split(self, args)
{
int len, i, j, err;
char *s;
- char c;
object *list, *item;
if (!getargs(args, "s#", &s, &len))
@@ -52,13 +51,11 @@ strop_split(self, args)
i = 0;
while (i < len) {
- while (i < len &&
- ((c = s[i]), isspace(c))) {
+ while (i < len && isspace(Py_CHARMASK(s[i]))) {
i = i+1;
}
j = i;
- while (i < len &&
- !((c = s[i]), isspace(c))) {
+ while (i < len && isspace(Py_CHARMASK(s[i]))) {
i = i+1;
}
if (j < i) {
@@ -269,20 +266,19 @@ strop_strip(self, args)
{
char *s;
int len, i, j;
- char c;
if (!getargs(args, "s#", &s, &len))
return NULL;
i = 0;
- while (i < len && ((c = s[i]), isspace(c))) {
+ while (i < len && isspace(Py_CHARMASK(s[i]))) {
i++;
}
j = len;
do {
j--;
- } while (j >= i && ((c = s[j]), isspace(c)));
+ } while (j >= i && isspace(Py_CHARMASK(s[i])));
j++;
if (i == 0 && j == len) {
@@ -312,7 +308,7 @@ strop_lower(self, args)
s_new = getstringvalue(new);
changed = 0;
for (i = 0; i < n; i++) {
- char c = *s++;
+ int c = Py_CHARMASK(*s++);
if (isupper(c)) {
changed = 1;
*s_new = tolower(c);
@@ -347,7 +343,7 @@ strop_upper(self, args)
s_new = getstringvalue(new);
changed = 0;
for (i = 0; i < n; i++) {
- char c = *s++;
+ int c = Py_CHARMASK(*s++);
if (islower(c)) {
changed = 1;
*s_new = toupper(c);
@@ -382,7 +378,7 @@ strop_swapcase(self, args)
s_new = getstringvalue(new);
changed = 0;
for (i = 0; i < n; i++) {
- char c = *s++;
+ int c = Py_CHARMASK(*s++);
if (islower(c)) {
changed = 1;
*s_new = toupper(c);
@@ -530,7 +526,7 @@ initstrop()
/* Create 'whitespace' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (isspace(c))
buf[n++] = c;
}
@@ -541,7 +537,7 @@ initstrop()
}
/* Create 'lowercase' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (islower(c))
buf[n++] = c;
}
@@ -553,7 +549,7 @@ initstrop()
/* Create 'uppercase' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (isupper(c))
buf[n++] = c;
}