From 8f40acce2f09f9a7a14790c0479f2ea82f5bbde7 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 8 Mar 2021 04:45:07 -0700 Subject: [PATCH] perl.h: Remove LOCALECONV_LOCK This is needed in just one function, in locale.c, so more it there. --- locale.c | 9 +++++---- perl.h | 17 +---------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/locale.c b/locale.c index 7d207cf5a1cf..9dfa9ade19aa 100644 --- a/locale.c +++ b/locale.c @@ -3092,10 +3092,11 @@ S_my_localeconv(pTHX_ const int item) # endif - LOCALECONV_LOCK; + gwLOCALE_LOCK; + retval = copy_localeconv(aTHX_ localeconv(), numeric_locale_is_utf8, monetary_locale_is_utf8); - LOCALECONV_UNLOCK; + gwLOCALE_UNLOCK; # ifdef USE_LOCALE_NUMERIC @@ -3155,10 +3156,10 @@ S_my_localeconv(pTHX_ const int item) void_setlocale_c(LC_ALL, save_thread); /* Safely stash the desired data */ - LOCALECONV_LOCK; + gwLOCALE_LOCK; retval = copy_localeconv(aTHX_ localeconv(), numeric_locale_is_utf8, monetary_locale_is_utf8); - LOCALECONV_UNLOCK; + gwLOCALE_UNLOCK; /* Restore the global locale's prior state */ void_setlocale_c(LC_ALL, save_global); diff --git a/perl.h b/perl.h index 531aeb286714..d55e0315f018 100644 --- a/perl.h +++ b/perl.h @@ -6756,16 +6756,11 @@ the plain locale pragma without a parameter (S>) is in effect. #endif #if ! ( defined(USE_LOCALE) \ && defined(USE_LOCALE_THREADS) \ - && ( ! defined(USE_THREAD_SAFE_LOCALE) \ - || ( defined(HAS_LOCALECONV) \ - && ( ! defined(HAS_LOCALECONV_L) \ - || defined(TS_W32_BROKEN_LOCALECONV))))) + && ( ! defined(USE_THREAD_SAFE_LOCALE))) /* The whole expression just above was complemented, so here we have no need * for thread synchronization, most likely it would be that this isn't a * threaded build. */ -# define LOCALECONV_LOCK NOOP -# define LOCALECONV_UNLOCK NOOP # define LOCALE_READ_LOCK NOOP # define LOCALE_READ_UNLOCK NOOP # define SETLOCALE_LOCK NOOP @@ -6801,16 +6796,6 @@ the plain locale pragma without a parameter (S>) is in effect. * modern platforms will have reentrant versions (which don't lock) for * almost all of them, so khw thinks a single mutex should suffice. */ - /* We do define a different macro for each case; then if we want to have - * separate mutexes for some of them, the only changes needed are here. - * Define just the necessary macros. The compiler should then croak if the - * #ifdef's in the code are incorrect */ -# if defined(HAS_LOCALECONV) && ( ! defined(USE_POSIX_2008_LOCALE) \ - || ! defined(HAS_LOCALECONV_L) \ - || defined(TS_W32_BROKEN_LOCALECONV)) -# define LOCALECONV_LOCK LOCALE_LOCK_(0) -# define LOCALECONV_UNLOCK LOCALE_UNLOCK_ -# endif # if defined(USE_THREAD_SAFE_LOCALE) /* There may be instance core where we this is invoked yet should do