]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
wc: stop worrying about EBCDIC, shift-JIS, etc
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Sep 2023 01:45:08 +0000 (18:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Sep 2023 07:28:26 +0000 (00:28 -0700)
* src/wc.c: Do not include mbchar.h.
(wc): Check for ASCII characters instead of using is_basic.
Other parts of Gnulib and coreutils already assume the encoding
is upward compatible with ASCII, and the old code wouldn’t
have worked anyway with shift-JIS.

src/wc.c

index 6b802f5c7fb6462e8d7205baede91e6126fc1be0..130be8c32c68c3b975d57f0161e770efb398d0ca 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -31,7 +31,6 @@
 #include "argmatch.h"
 #include "argv-iter.h"
 #include "fadvise.h"
-#include "mbchar.h"
 #include "physmem.h"
 #include "readtokens0.h"
 #include "safe-read.h"
@@ -490,7 +489,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos)
               size_t n;
               bool wide = true;
 
-              if (!in_shift && is_basic (*p))
+              if (!in_shift && 0 <= *p && *p < 0x80)
                 {
                   /* Handle most ASCII characters quickly, without calling
                      mbrtowc().  */