summaryrefslogtreecommitdiff
path: root/vutil.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-02-05 22:11:51 -0700
committerKarl Williamson <khw@cpan.org>2018-02-18 15:44:23 -0700
commite9bc6d6b34afc0063cc5181b59f77eeb81b1182d (patch)
tree1028b01c95db9ebdc6d78340ca1f00aad07fe922 /vutil.h
parentddd5ebe0cadc81a0360ad8007674490fda89ee88 (diff)
downloadperl-e9bc6d6b34afc0063cc5181b59f77eeb81b1182d.tar.gz
Add thread-safe locale handling
This (large) commit allows locales to be used in threaded perls on platforms that support it. This includes recent Windows and Posix 2008 ones.
Diffstat (limited to 'vutil.h')
-rw-r--r--vutil.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/vutil.h b/vutil.h
index e291408db6..193c66d561 100644
--- a/vutil.h
+++ b/vutil.h
@@ -223,21 +223,28 @@ const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char**
#endif
-#if PERL_VERSION_LT(5,19,0)
-# undef STORE_NUMERIC_LOCAL_SET_STANDARD
-# undef RESTORE_NUMERIC_LOCAL
-# ifdef USE_LOCALE
-# define STORE_NUMERIC_LOCAL_SET_STANDARD()\
- char *loc = savepv(setlocale(LC_NUMERIC, NULL)); \
+#if PERL_VERSION_LT(5,27,9)
+# define LC_NUMERIC_LOCK
+# define LC_NUMERIC_UNLOCK
+# if PERL_VERSION_LT(5,19,0)
+# undef STORE_LC_NUMERIC_SET_STANDARD
+# undef RESTORE_LC_NUMERIC
+# undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
+# ifdef USE_LOCALE
+# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *loc
+# define STORE_NUMERIC_SET_STANDARD()\
+ loc = savepv(setlocale(LC_NUMERIC, NULL)); \
SAVEFREEPV(loc); \
setlocale(LC_NUMERIC, "C");
-# define RESTORE_NUMERIC_LOCAL()\
+# define RESTORE_LC_NUMERIC()\
setlocale(LC_NUMERIC, loc);
-# else
-# define STORE_NUMERIC_LOCAL_SET_STANDARD()
-# define RESTORE_NUMERIC_LOCAL()
-# endif
+# else
+# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION
+# define STORE_LC_NUMERIC_SET_STANDARD()
+# define RESTORE_LC_NUMERIC()
+# endif
+# endif
#endif
#ifndef LOCK_NUMERIC_STANDARD