It is not clear to me why this code was using unsigned char when it can do the
same thing with less typing and fewer compiler warnings using char. This also
introduces casts to squash warnings from some of the more pedantic compiler
implementations. See
6c29170f9f29466374fbc6e8e62a1b6916c6bc59 for details.
static char *canontoken(char *str)
{
- static unsigned char *canon;
+ static char *canon;
static size_t allocated;
- unsigned char c, *p, *q;
+ char c, *p, *q;
size_t len;
- p = (unsigned char *) str;
+ p = str;
len = strlen(str);
if (len >= allocated) {
allocated = len + 1 + 10;
- canon = newof(canon, unsigned char, allocated, 0);
+ canon = newof(canon, char, allocated, 0);
if (!canon)
return NULL;
}
q = canon;
while ((c = *p++)) {
- if (isupper(c))
- c = tolower(c);
+ if (isupper((int)c))
+ c = (char)tolower((int)c);
*q++ = c;
}
*q = '\0';
- return (char*)canon;
+ return canon;
}
/* fullColor: