]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: omit unnecessary to_uchar
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Nov 2024 17:18:50 +0000 (09:18 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Nov 2024 17:53:55 +0000 (09:53 -0800)
* 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’.

src/df.c
src/dircolors.c
src/printf.c
src/ptx.c
src/stat.c
src/tr.c

index b78ee5e53212782fab80ce57cd7356caa1e6ac18..202bfa27971559b8c964585804854d574cf65164 100644 (file)
--- 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++;
     }
index 5722c49b003828e17edd66b346b187e4328bd947..dbe10d599e8bd02dc4548e80888face577521a81 100644 (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;
 
index d7730ae6cf4b38b4508faf939d3fb7e86b2f56a1..bb5a7c72310bf48e78e3d3ed120447a6b00df597 100644 (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);
         }
index c1a6994b3217aa81a9d6d8cbf8b6f2f64670e98c..2d35c8e249afb000e3311f564fd43283deaac6b2 100644 (file)
--- 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)
index 1513abfaaa0a664da57c4792c25b099a6e867e79..264efc296f98e70f2dcc07f71e67b2db6950e985 100644 (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);
index 94869169ce17fe3117e2b058e82463b74d803af4..4201dd0aab614583a6b3847434d0c0a93d0cc759 100644 (file)
--- 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;
 }