Avoid using (char) in <ctype.h> macros (#61)

This commit is contained in:
Tony Lawrence 2022-10-22 20:02:23 -04:00
parent 70c80ac22e
commit c50d4c34d8
2 changed files with 8 additions and 8 deletions

View File

@ -278,7 +278,7 @@ static char *rl_find_token(size_t *len)
int pos; int pos;
for (pos = rl_point; pos < rl_end; pos++) { for (pos = rl_point; pos < rl_end; pos++) {
if (isspace(rl_line_buffer[pos])) { if (isspace((unsigned char) rl_line_buffer[pos])) {
if (pos > 0) if (pos > 0)
pos--; pos--;
break; break;
@ -286,7 +286,7 @@ static char *rl_find_token(size_t *len)
} }
ptr = &rl_line_buffer[pos]; ptr = &rl_line_buffer[pos];
while (pos >= 0 && !isspace(rl_line_buffer[pos])) { while (pos >= 0 && !isspace((unsigned char) rl_line_buffer[pos])) {
if (pos == 0) if (pos == 0)
break; break;

View File

@ -494,10 +494,10 @@ static el_status_t do_case(el_case_t type)
for (i = rl_point, p = &rl_line_buffer[i]; rl_point < end; p++) { for (i = rl_point, p = &rl_line_buffer[i]; rl_point < end; p++) {
if ((type == TOupper) || (type == TOcapitalize && rl_point == i)) { if ((type == TOupper) || (type == TOcapitalize && rl_point == i)) {
if (islower(*p)) if (islower((unsigned char)(*p)))
*p = toupper(*p); *p = toupper((unsigned char)(*p));
} else if (isupper(*p)) { } else if (isupper((unsigned char)(*p))) {
*p = tolower(*p); *p = tolower((unsigned char)(*p));
} }
right(CSmove); right(CSmove);
} }
@ -1875,14 +1875,14 @@ static int argify(char *line, char ***avp)
if (!p) if (!p)
return 0; return 0;
for (c = line; isspace(*c); c++) for (c = line; isspace((unsigned char)(*c)); c++)
continue; continue;
if (*c == '\n' || *c == '\0') if (*c == '\n' || *c == '\0')
return 0; return 0;
for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) { for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) {
if (!isspace(*c)) { if (!isspace((unsigned char)(*c))) {
c++; c++;
continue; continue;
} }