texinfo-commits
[Top][All Lists]
Advanced

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

[8008] perl 5.28 thread-safe locales


From: gavinsmith0123
Subject: [8008] perl 5.28 thread-safe locales
Date: Fri, 13 Jul 2018 11:39:30 -0400 (EDT)

Revision: 8008
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8008
Author:   gavin
Date:     2018-07-13 11:39:29 -0400 (Fri, 13 Jul 2018)
Log Message:
-----------
perl 5.28 thread-safe locales

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Convert/XSParagraph/xspara.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-07-13 15:31:28 UTC (rev 8007)
+++ trunk/ChangeLog     2018-07-13 15:39:29 UTC (rev 8008)
@@ -1,5 +1,20 @@
 2018-07-13  Niko Tyni <address@hidden>  (tiny change)
 
+       Perl 5.28 introduced thread-safe locales, where 'setlocale'
+       only affects the locale of the current thread. External code
+       like 'mbrtowc' isn't aware of this thread specific locale,
+       so we need to explicitly modify the global one instead.
+       
+       Without this we could enter a busy loop in xspara__add_next
+       (Texinfo::Convert::XSParagraph) for UTF-8 documents when mbrtowc
+       returned -1.
+
+       * tp/Texinfo/Convert/XSParagraph/xspara.c (xspara_init)
+       [Perl version >= 5.28]: Call 'switch_to_global_locale' and 
+       'sync_locale'.
+
+2018-07-13  Niko Tyni <address@hidden>  (tiny change)
+
        * tp/Texinfo/Parser.pm (_parse_special_misc_command) <@clickstyle>:
        Escape braces in regex to be compatible with recent Perl 
        versions.

Modified: trunk/tp/Texinfo/Convert/XSParagraph/xspara.c
===================================================================
--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2018-07-13 15:31:28 UTC 
(rev 8007)
+++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c       2018-07-13 15:39:29 UTC 
(rev 8008)
@@ -248,6 +248,11 @@
 
   dTHX;
 
+#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
+  /* needed due to thread-safe locale handling in newer perls */
+  switch_to_global_locale();
+#endif
+
   if (setlocale (LC_CTYPE, "en_US.UTF-8")
       || setlocale (LC_CTYPE, "en_US.utf8"))
     goto success;
@@ -320,6 +325,10 @@
     {
 success: ;
       free (utf8_locale);
+#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
+      /* needed due to thread-safe locale handling in newer perls */
+      sync_locale();
+#endif
       /*
       fprintf (stderr, "tried to set LC_CTYPE to UTF-8.\n");
       fprintf (stderr, "character encoding is: %s\n",




reply via email to

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