Skip to content

Commit

Permalink
locale.c: Only compile workaround on platforms needing it
Browse files Browse the repository at this point in the history
This code works around a bug on Windows with regard to localeconv().
And the bug only exists on such platforms that have thread-safety.
Prior to this commit, the code was compiled on platforms lacking
thread-safety, so was unnecessary.
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent 6fb8372 commit 0a0888f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locale.c
Expand Up @@ -5250,7 +5250,7 @@ S_populate_hash_from_localeconv(pTHX_ HV * hv,
* accesses until we have made a copy of its returned static buffer */
gwLOCALE_LOCK;

# ifdef TS_W32_BROKEN_LOCALECONV
# if defined(TS_W32_BROKEN_LOCALECONV) && defined(USE_THREAD_SAFE_LOCALE)

/* This is a workaround for another bug in Windows. localeconv() was
* broken with thread-safe locales prior to VS 15. It looks at the global
Expand Down Expand Up @@ -5360,7 +5360,7 @@ S_populate_hash_from_localeconv(pTHX_ HV * hv,

/* Done with copying to the hash. Can unwind the critical section locks */

# ifdef TS_W32_BROKEN_LOCALECONV
# if defined(TS_W32_BROKEN_LOCALECONV) && defined(USE_THREAD_SAFE_LOCALE)

/* Restore the global locale's prior state */
void_setlocale_c(LC_ALL, save_global);
Expand Down

0 comments on commit 0a0888f

Please sign in to comment.