{
int len, i, j, err;
char *s;
- char c;
object *list, *item;
if (!getargs(args, "s#", &s, &len))
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) {
{
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) {
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);
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);
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);
/* Create 'whitespace' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (isspace(c))
buf[n++] = c;
}
}
/* Create 'lowercase' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (islower(c))
buf[n++] = c;
}
/* Create 'uppercase' object */
n = 0;
- for (c = 1; c < 256; c++) {
+ for (c = 0; c < 256; c++) {
if (isupper(c))
buf[n++] = c;
}
#include "config.h"
#endif
+/* Convert a possibly signed character to a nonnegative int */
+/* XXX This assumes characters are 8 bits wide */
+#ifdef __CHAR_UNSIGNED__
+#define Py_CHARMASK(c) (c)
+#else
+#define Py_CHARMASK(c) ((c) & 0xff)
+#endif
+
#include "rename2.h"
/* strtol and strtoul, renamed to avoid conflicts */
}
/* skip leading white space */
- while (*str && isspace(*str))
+ while (*str && isspace(Py_CHARMASK(*str)))
str++;
/* check for leading 0 or 0x for auto-base or base 16 */
}
/* do the conversion */
- while (c = *str)
+ while (c = Py_CHARMASK(*str))
{
if (isdigit(c) && c - '0' < base)
c -= '0';
long result;
char sign;
- while (*str && isspace(*str))
+ while (*str && isspace(Py_CHARMASK(*str)))
str++;
sign = *str;