Skip to content

Commit

Permalink
locale.c: Fix compilation on platforms with only a C locale
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Horodniceanu <[email protected]>
  • Loading branch information
the-horo authored and khwilliamson committed Sep 9, 2024
1 parent ccc51b7 commit f18202d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Andreas König <[email protected]>
Andreas Marienborg <[email protected]>
Andreas Schwab <[email protected]>
Andreas Voegele <[email protected]>
Andrei Horodniceanu <[email protected]>
Andrei Yelistratov <[email protected]>
Andrej Borsenkow <[email protected]>
Andrew Bettison <[email protected]>
Expand Down
16 changes: 16 additions & 0 deletions locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -8972,6 +8972,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
* categories into our internal indices. */
if (map_LC_ALL_position_to_index[0] == LC_ALL_INDEX_) {

# ifdef PERL_LC_ALL_CATEGORY_POSITIONS_INIT
/* Use this array, initialized by a config.h constant */
int lc_all_category_positions[] = PERL_LC_ALL_CATEGORY_POSITIONS_INIT;
STATIC_ASSERT_STMT( C_ARRAY_LENGTH(lc_all_category_positions)
Expand All @@ -8984,6 +8985,21 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
map_LC_ALL_position_to_index[i] =
get_category_index(lc_all_category_positions[i]);
}
# else
/* It is possible for both PERL_LC_ALL_USES_NAME_VALUE_PAIRS and
* PERL_LC_ALL_CATEGORY_POSITIONS_INIT not to be defined, e.g. on
* systems with only a C locale during ./Configure. Assume that this
* can only happen as part of some sort of bootstrapping so allow
* compilation to succeed by ignoring correctness.
*/
for (unsigned int i = 0;
i < C_ARRAY_LENGTH(map_LC_ALL_position_to_index);
i++)
{
map_LC_ALL_position_to_index[i] = 0;
}
# endif

}

LOCALE_UNLOCK;
Expand Down

0 comments on commit f18202d

Please sign in to comment.