Skip to content

Commit

Permalink
S_toggle_locale_i: Move some assert()s, initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed May 6, 2023
1 parent 11de12e commit 05bd07c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions locale.c
Expand Up @@ -6812,22 +6812,19 @@ S_toggle_locale_i(pTHX_ const unsigned cat_index,
const char * new_locale,
const line_t caller_line)
{
PERL_ARGS_ASSERT_TOGGLE_LOCALE_I;
assert(cat_index <= LC_ALL_INDEX_);

/* Changes the locale for the category specified by 'index' to 'new_locale,
* if they aren't already the same.
*
* Returns a copy of the name of the original locale for 'cat_index'
* so can be switched back to with the companion function
* restore_toggled_locale_i(), (NULL if no restoral is necessary.) */

const char * locale_to_restore_to = NULL;

PERL_ARGS_ASSERT_TOGGLE_LOCALE_I;
assert(cat_index <= LC_ALL_INDEX_);

/* Find the original locale of the category we may need to change, so that
* it can be restored to later */

locale_to_restore_to = querylocale_i(cat_index);
const char * locale_to_restore_to = querylocale_i(cat_index);

DEBUG_Lv(PerlIO_printf(Perl_debug_log,
"(%" LINE_Tf "): toggle_locale_i: index=%d(%s), wanted=%s,"
Expand Down

0 comments on commit 05bd07c

Please sign in to comment.