Skip to content

Commit

Permalink
perl.h: Remove LOCALECONV_LOCK
Browse files Browse the repository at this point in the history
This is needed in just one function, in locale.c, so more it there.
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent 898f808 commit 8f40acc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
9 changes: 5 additions & 4 deletions locale.c
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down
17 changes: 1 addition & 16 deletions perl.h
Expand Up @@ -6756,16 +6756,11 @@ the plain locale pragma without a parameter (S<C<use locale>>) 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
Expand Down Expand Up @@ -6801,16 +6796,6 @@ the plain locale pragma without a parameter (S<C<use locale>>) 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
Expand Down

0 comments on commit 8f40acc

Please sign in to comment.