From 75e5670a140542e83ee2d31dd51d7143e3cbdde9 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 13 Mar 2021 20:17:29 -0700 Subject: [PATCH] perl.h: Move #defining SETLOCALE_LOCK This simplifies slightly, and will allow further simplification --- perl.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/perl.h b/perl.h index 04de80a73ab1..d967c494938f 100644 --- a/perl.h +++ b/perl.h @@ -6724,7 +6724,8 @@ the plain locale pragma without a parameter (S>) is in effect. /* By definition, a thread-unsafe locale means we need a critical * section. */ - +# define SETLOCALE_LOCK LOCALE_LOCK_(0) +# define SETLOCALE_UNLOCK LOCALE_UNLOCK_ # ifdef USE_LOCALE_NUMERIC # define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \ LOCALE_LOCK_(cond_to_panic_if_already_locked) @@ -6763,8 +6764,6 @@ the plain locale pragma without a parameter (S>) is in effect. * threaded build. */ # define LOCALE_READ_LOCK NOOP # define LOCALE_READ_UNLOCK NOOP -# define SETLOCALE_LOCK NOOP -# define SETLOCALE_UNLOCK NOOP #else /* Here, we will need critical sections in locale handling, because one or @@ -6796,16 +6795,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. */ -# if defined(USE_THREAD_SAFE_LOCALE) - - /* There may be instance core where we this is invoked yet should do - * nothing. Rather than have #ifdef's around them, define it here */ -# define SETLOCALE_LOCK NOOP -# define SETLOCALE_UNLOCK NOOP -# else -# define SETLOCALE_LOCK LOCALE_LOCK_(0) -# define SETLOCALE_UNLOCK LOCALE_UNLOCK_ -# endif #endif #ifndef LOCALE_LOCK_ @@ -6850,6 +6839,12 @@ the plain locale pragma without a parameter (S>) is in effect. # define PORCELAIN_SETLOCALE_UNLOCK gwLOCALE_UNLOCK #endif +/* This was defined above for the case where locales aren't thread safe. */ +#ifndef SETLOCALE_LOCK +# define SETLOCALE_LOCK NOOP +# define SETLOCALE_UNLOCK NOOP +#endif + #ifndef LC_NUMERIC_LOCK # define LC_NUMERIC_LOCK(cond) NOOP # define LC_NUMERIC_UNLOCK NOOP