maint: omit unnecessary to_uchar

* src/df.c (replace_control_chars):
* src/dircolors.c (parse_line):
* src/printf.c (print_esc):
* src/ptx.c (unescape_string):
* src/stat.c (print_it):
* src/tr.c (star_digits_closebracket):
Omit to_uchar calls that aren’t needed, because the parent
expression works with ‘char’ as well as with ‘unsigned char’.
This commit is contained in:
Paul Eggert committed 2024-11-19 09:53:55 -08:00
1 parent 60995c36f3
commit e3ccd26aca
6 files changed
+11 -11

No files matched your search

+1 -1
View File
@@ -307,7 +307,7 @@ replace_control_chars (char *cell)
char *p = cell;
while (*p)
{
if (c_iscntrl (to_uchar (*p)))
if (c_iscntrl (*p))
*p = '?';
p++;
}
+4 -4
View File
@@ -153,7 +153,7 @@ parse_line (char const *line, char **keyword, char **arg)
*keyword = nullptr;
*arg = nullptr;
for (p = line; c_isspace (to_uchar (*p)); ++p)
for (p = line; c_isspace (*p); ++p)
continue;
/* Ignore blank lines and shell-style comments. */
@@ -162,7 +162,7 @@ parse_line (char const *line, char **keyword, char **arg)
keyword_start = p;
while (!c_isspace (to_uchar (*p)) && *p != '\0')
while (!c_isspace (*p) && *p != '\0')
{
++p;
}
@@ -175,7 +175,7 @@ parse_line (char const *line, char **keyword, char **arg)
{
++p;
}
while (c_isspace (to_uchar (*p)));
while (c_isspace (*p));
if (*p == '\0' || *p == '#')
return;
@@ -185,7 +185,7 @@ parse_line (char const *line, char **keyword, char **arg)
while (*p != '\0' && *p != '#')
++p;
for (--p; c_isspace (to_uchar (*p)); --p)
for (--p; c_isspace (*p); --p)
continue;
++p;
+2 -2
View File
@@ -225,7 +225,7 @@ print_esc (char const *escstart, bool octal_0)
{
/* A hexadecimal \xhh escape sequence must have 1 or 2 hex. digits. */
for (esc_length = 0, ++p;
esc_length < 2 && c_isxdigit (to_uchar (*p));
esc_length < 2 && c_isxdigit (*p);
++esc_length, ++p)
esc_value = esc_value * 16 + fromhex (*p);
if (esc_length == 0)
@@ -255,7 +255,7 @@ print_esc (char const *escstart, bool octal_0)
esc_length > 0;
--esc_length, ++p)
{
if (! c_isxdigit (to_uchar (*p)))
if (! c_isxdigit (*p))
error (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
uni_value = uni_value * 16 + fromhex (*p);
}
+1 -1
View File
@@ -312,7 +312,7 @@ unescape_string (char *string)
case 'x': /* \xhhh escape, 3 chars maximum */
value = 0;
for (length = 0, string++;
length < 3 && c_isxdigit (to_uchar (*string));
length < 3 && c_isxdigit (*string);
length++, string++)
value = value * 16 + HEXTOBIN (*string);
if (length == 0)
+2 -2
View File
@@ -1215,13 +1215,13 @@ print_it (char const *format, int fd, char const *filename,
putchar (esc_value);
--b;
}
else if (*b == 'x' && c_isxdigit (to_uchar (b[1])))
else if (*b == 'x' && c_isxdigit (b[1]))
{
int esc_value = fromhex (b[1]); /* Value of \xhh escape. */
/* A hexadecimal \xhh escape sequence must have
1 or 2 hex. digits. */
++b;
if (c_isxdigit (to_uchar (b[1])))
if (c_isxdigit (b[1]))
{
++b;
esc_value = esc_value * 16 + fromhex (*b);
+1 -1
View File
@@ -830,7 +830,7 @@ star_digits_closebracket (const struct E_string *es, size_t idx)
return false;
for (size_t i = idx + 1; i < es->len; i++)
if (!ISDIGIT (to_uchar (es->s[i])) || es->escaped[i])
if (!ISDIGIT (es->s[i]) || es->escaped[i])
return es_match (es, i, ']');
return false;
}