Skip to content

Commit

Permalink
S_update_PL_curlocales_i(): Reverse order of conditionals
Browse files Browse the repository at this point in the history
The new ordering will play better with future commits
  • Loading branch information
khwilliamson committed May 12, 2023
1 parent 2ee8dd9 commit 9430407
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions locale.c
Expand Up @@ -2103,16 +2103,7 @@ S_update_PL_curlocales_i(pTHX_
PERL_UNUSED_ARG(caller_line);
assert(index <= LC_ALL_INDEX_);

if (index == LC_ALL_INDEX_) {

/* For LC_ALL, we change all individual categories to correspond,
* including the LC_ALL element */
for (unsigned int i = 0; i <= LC_ALL_INDEX_; i++) {
Safefree(PL_curlocales[i]);
PL_curlocales[i] = savepv(new_locale);
}
}
else { /* Not LC_ALL */
if (index != LC_ALL_INDEX_) {

/* Update the single category's record */
Safefree(PL_curlocales[index]);
Expand All @@ -2122,6 +2113,15 @@ S_update_PL_curlocales_i(pTHX_
Safefree(PL_curlocales[LC_ALL_INDEX_]);
PL_curlocales[LC_ALL_INDEX_] = NULL;
}
else { /* LC_ALL */

/* For LC_ALL, we change all individual categories to correspond,
* including the LC_ALL element */
for (unsigned int i = 0; i <= LC_ALL_INDEX_; i++) {
Safefree(PL_curlocales[i]);
PL_curlocales[i] = savepv(new_locale);
}
}
}

# endif /* Need PL_curlocales[] */
Expand Down

0 comments on commit 9430407

Please sign in to comment.