]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: port to oddball tolower
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 28 Oct 2023 16:07:14 +0000 (09:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 30 Oct 2023 07:58:04 +0000 (00:58 -0700)
* src/digest.c (hex_equal): Work even in oddball locales
where tolower does not work as expected on ASCII letters.

src/digest.c

index 336392608a9381036ad8f6e975708213d49d4c2d..052fa4db71dfe586a54b52e40be24f7c07ed9ee0 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <config.h>
 
-#include <ctype.h>
 #include <getopt.h>
 #include <sys/types.h>
 
@@ -1122,9 +1121,9 @@ hex_equal (unsigned char const *hex_digest, unsigned char const *bin_buffer)
   size_t cnt;
   for (cnt = 0; cnt < digest_bin_bytes; ++cnt)
     {
-      if (tolower (hex_digest[2 * cnt])
+      if (c_tolower (hex_digest[2 * cnt])
           != bin2hex[bin_buffer[cnt] >> 4]
-          || (tolower (hex_digest[2 * cnt + 1])
+          || (c_tolower (hex_digest[2 * cnt + 1])
               != (bin2hex[bin_buffer[cnt] & 0xf])))
         break;
     }