Subject: bug#32236: df header corrupted with LANG=zh_TW.UTF-8 on macOS

From: Paul Eggert <[email-masked]>
Date: Fri, 27 Jul 2018 12:05:17 -0700

Bruno Haible wrote:
> You can assume that mbrtowc returns
> 0 if and only if the multibyte sequence is a NUL byte - but you had
> chosen srcend in such a way that this would not happen in the loop.

Thanks for the correction. I mistakenly thought that C allows multibyte 
encodings in which a null wide character's multibyte representation contains an 
all-bits-zero byte. I installed the attached to omit the unnecessary test.
From 34e261fa2768533f34cf35158489ea6a22115c17 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Fri, 27 Jul 2018 12:00:02 -0700
Subject: [PATCH] df: omit redundant comparison

Trivial inefficiency reported by Bruno Haible in:
http://lists.gnu.org/r/bug-gnulib/2018-07/msg00109.html
* src/df.c (hide_problematic_chars): Omit redundant test.
---
 src/df.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/df.c b/src/df.c
index 9b65872..5553221 100644
--- a/src/df.c
+++ b/src/df.c
@@ -288,7 +288,7 @@ hide_problematic_chars (char *cell)
       wchar_t wc;
       size_t srcbytes = srcend - src;
       n = mbrtowc (&wc, src, srcbytes, &mbstate);
-      bool ok = 0 < n && n <= srcbytes;
+      bool ok = n <= srcbytes;
 
       if (ok)
         ok = !iswcntrl (wc);
-- 
2.7.4