texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6136] wcwidth replacement for MinGW


From: Gavin D. Smith
Subject: [6136] wcwidth replacement for MinGW
Date: Sat, 21 Feb 2015 12:35:39 +0000

Revision: 6136
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6136
Author:   gavin
Date:     2015-02-21 12:35:38 +0000 (Sat, 21 Feb 2015)
Log Message:
-----------
wcwidth replacement for MinGW

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c
    trunk/info/pcterm.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-02-21 12:04:07 UTC (rev 6135)
+++ trunk/ChangeLog     2015-02-21 12:35:38 UTC (rev 6136)
@@ -1,3 +1,11 @@
+2015-02-21  Eli Zaretskii  <address@hidden>
+
+       * info/info-utils.c [__MINGW32__]: Undef wcwidth, to avoid its
+       redirection from the MinGW-specific version in pcterm.c.
+
+       * info/pcterm.c (wcwidth) [_WIN32] [!HAVE_WCWIDTH]: A replacement
+       for wcwidth that works around the slow-down in the Gnulib version.
+
 2015-02-21  Gavin Smith  <address@hidden>
 
        * info/session.c (info_move_to_prev_xref)

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2015-02-21 12:04:07 UTC (rev 6135)
+++ trunk/info/info-utils.c     2015-02-21 12:35:38 UTC (rev 6136)
@@ -27,12 +27,17 @@
 #include <langinfo.h>
 #if HAVE_ICONV
 # include <iconv.h>
+#endif
+#include <wchar.h>
 #ifdef __MINGW32__
+/* MinGW uses a replacement nl_langinfo, see pcterm.c.  */
 # define nl_langinfo rpl_nl_langinfo
 extern char * rpl_nl_langinfo (nl_item);
+/* MinGW uses its own replacement wcwidth, see pcterm.c for the
+   reasons.  Since Gnulib's wchar.h might redirect wcwidth to
+   rpl_wcwidth, we explicitly undo that here.  */
+#undef wcwidth
 #endif
-#endif
-#include <wchar.h>
 
 #ifdef __hpux
 #define va_copy(ap1,ap2) memcpy((&ap1),(&ap2),sizeof(va_list))

Modified: trunk/info/pcterm.c
===================================================================
--- trunk/info/pcterm.c 2015-02-21 12:04:07 UTC (rev 6135)
+++ trunk/info/pcterm.c 2015-02-21 12:35:38 UTC (rev 6136)
@@ -663,6 +663,23 @@
     return nl_langinfo (item);
 }
 
+#ifndef HAVE_WCWIDTH
+/* A replacement for wcwidth.  The Gnulib version calls setlocale for
+   every character Info is about to display, which makes display of
+   large nodes annoyingly slow.
+
+   Note that the Gnulib version is still compiled and put into
+   libgnu.a, because the configure script doesn't know about this
+   replacement.  But the linker will not pull the Gnulib version into
+   the binary, because it resolves the calls to this replacement
+   function.  */
+int
+wcwidth (int wc)
+{
+  return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
+}
+#endif
+
 #endif /* _WIN32 */
 
 /* Turn on reverse video. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]