Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: wcwidth autoconf bug



> hi,
> 
>> Not as far as I can see.  The programme is designed to return 0
>> (success) if it's been through all the stages of the test to see if
>> wcwidth is present but broken.  In that case the variable should be set
>> to "yes".
> 
> ah, i misunderstood the intention of the code.
> thanks for explanation.

even if libc wcwidth is broken in the sense of this test,
it has a far better chance to work than the alternative implementation
on non-__STDC_ISO_10646__ platforms.

YAMAMOTO Takashi

diff --git a/Src/compat.c b/Src/compat.c
index e36de32..6d08dab 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -630,7 +630,7 @@ strtoul(nptr, endptr, base)
 #endif /* HAVE_STRTOUL */
 
 /**/
-#ifdef BROKEN_WCWIDTH
+#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
 
 /*
  * This is an implementation of wcwidth() and wcswidth() (defined in
@@ -949,5 +949,5 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
 #endif /* 0 */
 
 /**/
-#endif /* BROKEN_WCWIDTH */
+#endif /* BROKEN_WCWIDTH && __STDC_ISO_10646__ */
 
diff --git a/Src/zsh.h b/Src/zsh.h
index cc3a670..afe22f0 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2678,7 +2678,7 @@ typedef wint_t convchar_t;
 #define MB_METASTRWIDTH(str)	mb_metastrlen(str, 1)
 #define MB_METASTRLEN2(str, widthp)	mb_metastrlen(str, widthp)
 
-#ifdef BROKEN_WCWIDTH
+#if defined(BROKEN_WCWIDTH) && defined(__STDC_ISO_10646__)
 #define WCWIDTH(wc)	mk_wcwidth(wc)
 #else
 #define WCWIDTH(wc)	wcwidth(wc)



Messages sorted by: Reverse Date, Date, Thread, Author