From: Paul Eggert Date: Tue, 19 Nov 2024 17:18:50 +0000 (-0800) Subject: maint: omit unnecessary to_uchar X-Git-Tag: v9.6~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3ccd26aca042b1eb2176cb0b0690d90d882001e;p=thirdparty%2Fcoreutils.git 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’. --- diff --git a/src/df.c b/src/df.c index b78ee5e532..202bfa2797 100644 --- a/src/df.c +++ b/src/df.c @@ -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++; } diff --git a/src/dircolors.c b/src/dircolors.c index 5722c49b00..dbe10d599e 100644 --- a/src/dircolors.c +++ b/src/dircolors.c @@ -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; diff --git a/src/printf.c b/src/printf.c index d7730ae6cf..bb5a7c7231 100644 --- a/src/printf.c +++ b/src/printf.c @@ -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); } diff --git a/src/ptx.c b/src/ptx.c index c1a6994b32..2d35c8e249 100644 --- a/src/ptx.c +++ b/src/ptx.c @@ -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) diff --git a/src/stat.c b/src/stat.c index 1513abfaaa..264efc296f 100644 --- a/src/stat.c +++ b/src/stat.c @@ -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); diff --git a/src/tr.c b/src/tr.c index 94869169ce..4201dd0aab 100644 --- a/src/tr.c +++ b/src/tr.c @@ -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; }