Skip to content

Commit

Permalink
locale.c: Bring declaration inside #if's
Browse files Browse the repository at this point in the history
This would now cause a compilation error if the code gets screwed up.
  • Loading branch information
khwilliamson committed May 12, 2023
1 parent 9e08477 commit 09be8b0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions locale.c
Expand Up @@ -7919,7 +7919,6 @@ Perl_switch_to_global_locale(pTHX)

DEBUG_L(PerlIO_printf(Perl_debug_log, "Entering switch_to_global; %s\n",
get_LC_ALL_display()));
bool perl_controls = false;

# ifdef USE_THREAD_SAFE_LOCALE

Expand All @@ -7928,19 +7927,21 @@ Perl_switch_to_global_locale(pTHX)

# ifdef USE_POSIX_2008_LOCALE

perl_controls = (LC_GLOBAL_LOCALE != uselocale((locale_t) 0));
const bool perl_controls = (LC_GLOBAL_LOCALE != uselocale((locale_t) 0));

# elif defined(WIN32)

int config_return = _configthreadlocale(0);
if (config_return == -1) {
locale_panic_("_configthreadlocale returned an error");
}
perl_controls = (config_return == _ENABLE_PER_THREAD_LOCALE);
const bool perl_controls = (config_return == _ENABLE_PER_THREAD_LOCALE);

# else
# error Unexpected Configuration
# endif
# else

const bool perl_controls = false;

# endif

/* No-op if already in global */
Expand Down

0 comments on commit 09be8b0

Please sign in to comment.