summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-02-11 12:33:23 -0700
committerKarl Williamson <khw@cpan.org>2022-08-09 18:05:59 -0600
commit827a4a051afa67d6b91304bc64744af3072038aa (patch)
treee7f1d7e1d38bd36e7bd230b54909efdb6f9f5217 /sv.c
parentc6efbad02ab04568fbee498752817f20f3124611 (diff)
downloadperl-827a4a051afa67d6b91304bc64744af3072038aa.tar.gz
locale.c: Add fcn to hide edge case undefined behavior
The POSIX 2008 API has an edge case in that the result of most of the functions when called with a global (as opposed to a per-thread) locale is undefined. The duplocale() function is the exception which will create a per-thread locale containing the values copied from the global one. This commit just calls duplocale, if needed, and the caller need not concern itself with this possibility
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 6f8fe602ed..bb30c91937 100644
--- a/sv.c
+++ b/sv.c
@@ -15845,6 +15845,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_underlying_numeric_obj = NULL;
# endif
#endif /* !USE_LOCALE_NUMERIC */
+#if defined(USE_POSIX_2008_LOCALE)
+ PL_scratch_locale_obj = NULL;
+#endif
#ifdef HAS_MBRLEN
PL_mbrlen_ps = proto_perl->Imbrlen_ps;