texinfo/perl-5.28-thread-safe-locales.patch
2019-09-30 11:18:22 -04:00

42 lines
1.4 KiB
Diff

From a028ef47353b03177aab3facb4b2b74f7c3823e2 Mon Sep 17 00:00:00 2001
From: Gavin Smith <gavinsmith0123@gmail.com>
Date: Fri, 13 Jul 2018 15:39:29 +0000
Subject: [PATCH 056/759] perl 5.28 thread-safe locales
git-svn-id: svn://127.0.0.1/svn_repo/texinfo/trunk@8008 39fee189-59d7-47db-b5d4-205258b72aed
---
ChangeLog | 15 +++++++++++++++
tp/Texinfo/Convert/XSParagraph/xspara.c | 9 +++++++++
2 files changed, 24 insertions(+)
diff --git a/tp/Texinfo/Convert/XSParagraph/xspara.c b/tp/Texinfo/Convert/XSParagraph/xspara.c
index 51eea4a30..f2d6d1ccd 100644
--- a/tp/Texinfo/Convert/XSParagraph/xspara.c
+++ b/tp/Texinfo/Convert/XSParagraph/xspara.c
@@ -248,6 +248,11 @@ xspara_init (void)
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 @@ failure:
{
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",
--
2.19.1