Skip to content

Commit

Permalink
Avoid using (char) in <ctype.h> macros (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
al20878 committed Oct 23, 2022
1 parent 70c80ac commit c50d4c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ static char *rl_find_token(size_t *len)
int 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)
pos--;
break;
}
}

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)
break;

Expand Down
12 changes: 6 additions & 6 deletions src/editline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
if ((type == TOupper) || (type == TOcapitalize && rl_point == i)) {
if (islower(*p))
*p = toupper(*p);
} else if (isupper(*p)) {
*p = tolower(*p);
if (islower((unsigned char)(*p)))
*p = toupper((unsigned char)(*p));
} else if (isupper((unsigned char)(*p))) {
*p = tolower((unsigned char)(*p));
}
right(CSmove);
}
Expand Down Expand Up @@ -1875,14 +1875,14 @@ static int argify(char *line, char ***avp)
if (!p)
return 0;

for (c = line; isspace(*c); c++)
for (c = line; isspace((unsigned char)(*c)); c++)
continue;

if (*c == '\n' || *c == '\0')
return 0;

for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) {
if (!isspace(*c)) {
if (!isspace((unsigned char)(*c))) {
c++;
continue;
}
Expand Down

0 comments on commit c50d4c3

Please sign in to comment.