Skip to content

Commit f18202d

Browse files
the-horokhwilliamson
authored andcommitted
locale.c: Fix compilation on platforms with only a C locale
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent ccc51b7 commit f18202d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Andreas König <a.koenig@mind.de>
103103
Andreas Marienborg <andreas.marienborg@gmail.com>
104104
Andreas Schwab <schwab@suse.de>
105105
Andreas Voegele <andreas@andreasvoegele.com>
106+
Andrei Horodniceanu <a.horodniceanu@proton.me>
106107
Andrei Yelistratov <andrew@sundale.net>
107108
Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
108109
Andrew Bettison <andrewb@zip.com.au>

locale.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8972,6 +8972,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
89728972
* categories into our internal indices. */
89738973
if (map_LC_ALL_position_to_index[0] == LC_ALL_INDEX_) {
89748974

8975+
# ifdef PERL_LC_ALL_CATEGORY_POSITIONS_INIT
89758976
/* Use this array, initialized by a config.h constant */
89768977
int lc_all_category_positions[] = PERL_LC_ALL_CATEGORY_POSITIONS_INIT;
89778978
STATIC_ASSERT_STMT( C_ARRAY_LENGTH(lc_all_category_positions)
@@ -8984,6 +8985,21 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
89848985
map_LC_ALL_position_to_index[i] =
89858986
get_category_index(lc_all_category_positions[i]);
89868987
}
8988+
# else
8989+
/* It is possible for both PERL_LC_ALL_USES_NAME_VALUE_PAIRS and
8990+
* PERL_LC_ALL_CATEGORY_POSITIONS_INIT not to be defined, e.g. on
8991+
* systems with only a C locale during ./Configure. Assume that this
8992+
* can only happen as part of some sort of bootstrapping so allow
8993+
* compilation to succeed by ignoring correctness.
8994+
*/
8995+
for (unsigned int i = 0;
8996+
i < C_ARRAY_LENGTH(map_LC_ALL_position_to_index);
8997+
i++)
8998+
{
8999+
map_LC_ALL_position_to_index[i] = 0;
9000+
}
9001+
# endif
9002+
89879003
}
89889004

89899005
LOCALE_UNLOCK;

0 commit comments

Comments
 (0)