From bffa51e274b9427cea2942be2b0224defd7b2dac Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 14 Mar 2018 21:08:54 -0600 Subject: [PATCH] Don't include interpreter variable unless used This adds an #ifdef around this variable, so that it isn't defined unless used. Spotted by Daniel Dragan. --- intrpvar.h | 2 ++ makedef.pl | 2 ++ sv.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/intrpvar.h b/intrpvar.h index 33d9526..6b56971f 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -262,7 +262,9 @@ PERLVAR(I, exit_flags, U8) /* was exit() unexpected, etc. */ PERLVAR(I, utf8locale, bool) /* utf8 locale detected */ PERLVAR(I, in_utf8_CTYPE_locale, bool) PERLVAR(I, in_utf8_COLLATE_locale, bool) +#if defined(USE_ITHREADS) && ! defined(USE_THREAD_SAFE_LOCALE) PERLVARI(I, lc_numeric_mutex_depth, int, 0) /* Emulate general semaphore */ +#endif PERLVARA(I, locale_utf8ness, 256, char) #ifdef USE_LOCALE_CTYPE diff --git a/makedef.pl b/makedef.pl index a339059..88273e5 100644 --- a/makedef.pl +++ b/makedef.pl @@ -368,6 +368,7 @@ unless ($define{'USE_ITHREADS'}) { PL_hints_mutex PL_locale_mutex PL_lc_numeric_mutex + PL_lc_numeric_mutex_depth PL_my_ctx_mutex PL_perlio_mutex PL_stashpad @@ -442,6 +443,7 @@ if (${^SAFE_LOCALES}) { # Don't need mutexes if have thread-safe operations ++$skip{PL_locale_mutex} unless $ARGS{PLATFORM} eq 'win32' && ($ARGS{CCTYPE} =~ s/MSVC//r) < 140; ++$skip{PL_lc_numeric_mutex}; + ++$skip{PL_lc_numeric_mutex_depth}; } unless ($define{'PERL_OP_PARENT'}) { diff --git a/sv.c b/sv.c index 1856ba3..1090384 100644 --- a/sv.c +++ b/sv.c @@ -15236,7 +15236,9 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_in_utf8_CTYPE_locale = proto_perl->Iin_utf8_CTYPE_locale; PL_in_utf8_COLLATE_locale = proto_perl->Iin_utf8_COLLATE_locale; my_strlcpy(PL_locale_utf8ness, proto_perl->Ilocale_utf8ness, sizeof(PL_locale_utf8ness)); +#if defined(USE_ITHREADS) && ! defined(USE_THREAD_SAFE_LOCALE) PL_lc_numeric_mutex_depth = 0; +#endif /* Unicode features (see perlrun/-C) */ PL_unicode = proto_perl->Iunicode; -- 1.8.3.1