@@ -1264,6 +1264,7 @@ S_locking_setlocale(pTHX_
1264
1264
}
1265
1265
1266
1266
#endif
1267
+ #ifdef USE_LOCALE
1267
1268
1268
1269
STATIC void
1269
1270
S_set_numeric_radix (pTHX_ const bool use_locale )
@@ -1299,6 +1300,10 @@ S_set_numeric_radix(pTHX_ const bool use_locale)
1299
1300
}
1300
1301
1301
1302
# endif
1303
+ #else
1304
+
1305
+ PERL_UNUSED_ARG (use_locale );
1306
+
1302
1307
#endif /* USE_LOCALE_NUMERIC and can find the radix char */
1303
1308
1304
1309
}
@@ -1481,7 +1486,6 @@ S_new_ctype(pTHX_ const char *newctype)
1481
1486
1482
1487
#ifndef USE_LOCALE_CTYPE
1483
1488
1484
- PERL_ARGS_ASSERT_NEW_CTYPE ;
1485
1489
PERL_UNUSED_ARG (newctype );
1486
1490
PERL_UNUSED_CONTEXT ;
1487
1491
@@ -1994,6 +1998,8 @@ S_new_collate(pTHX_ const char *newcoll)
1994
1998
1995
1999
}
1996
2000
2001
+ #endif
2002
+
1997
2003
#ifdef WIN32
1998
2004
1999
2005
STATIC char *
@@ -2139,11 +2145,20 @@ Perl_setlocale(const int category, const char * locale)
2139
2145
{
2140
2146
/* This wraps POSIX::setlocale() */
2141
2147
2148
+ #ifdef NO_LOCALE
2149
+
2150
+ PERL_UNUSED_ARG (category );
2151
+ PERL_UNUSED_ARG (locale );
2152
+
2153
+ return "C" ;
2154
+
2155
+ #else
2156
+
2142
2157
const char * retval ;
2143
2158
const char * newlocale ;
2144
2159
dSAVEDERRNO ;
2145
- DECLARATION_FOR_LC_NUMERIC_MANIPULATION ;
2146
2160
dTHX ;
2161
+ DECLARATION_FOR_LC_NUMERIC_MANIPULATION ;
2147
2162
2148
2163
#ifdef USE_LOCALE_NUMERIC
2149
2164
@@ -2262,6 +2277,8 @@ Perl_setlocale(const int category, const char * locale)
2262
2277
2263
2278
return retval ;
2264
2279
2280
+ #endif
2281
+
2265
2282
}
2266
2283
2267
2284
PERL_STATIC_INLINE const char *
@@ -2414,13 +2431,16 @@ S_my_nl_langinfo(const int item, bool toggle)
2414
2431
dTHX ;
2415
2432
const char * retval ;
2416
2433
2434
+ #ifdef USE_LOCALE_NUMERIC
2435
+
2417
2436
/* We only need to toggle into the underlying LC_NUMERIC locale for these
2418
2437
* two items, and only if not already there */
2419
2438
if (toggle && (( item != RADIXCHAR && item != THOUSEP )
2420
2439
|| PL_numeric_underlying ))
2421
- {
2440
+
2441
+ #endif /* No toggling needed if not using LC_NUMERIC */
2442
+
2422
2443
toggle = FALSE;
2423
- }
2424
2444
2425
2445
#if defined(HAS_NL_LANGINFO ) /* nl_langinfo() is available. */
2426
2446
# if ! defined(HAS_THREAD_SAFE_NL_LANGINFO_L ) \
@@ -2468,6 +2488,8 @@ S_my_nl_langinfo(const int item, bool toggle)
2468
2488
do_free = TRUE;
2469
2489
}
2470
2490
2491
+ # ifdef USE_LOCALE_NUMERIC
2492
+
2471
2493
if (toggle ) {
2472
2494
if (PL_underlying_numeric_obj ) {
2473
2495
cur = PL_underlying_numeric_obj ;
@@ -2478,6 +2500,8 @@ S_my_nl_langinfo(const int item, bool toggle)
2478
2500
}
2479
2501
}
2480
2502
2503
+ # endif
2504
+
2481
2505
/* We have to save it to a buffer, because the freelocale() just below
2482
2506
* can invalidate the internal one */
2483
2507
retval = save_to_buffer (nl_langinfo_l (item , cur ),
@@ -5169,17 +5193,16 @@ Perl_my_strerror(pTHX_ const int errnum)
5169
5193
LOCALE_UNLOCK ;
5170
5194
5171
5195
# endif /* End of doesn't have strerror_l */
5172
- #endif /* End of does have locale messages */
5173
-
5174
- #ifdef DEBUGGING
5196
+ # ifdef DEBUGGING
5175
5197
5176
5198
if (DEBUG_Lv_TEST ) {
5177
5199
PerlIO_printf (Perl_debug_log , "Strerror returned; saving a copy: '" );
5178
5200
print_bytes_for_locale (errstr , errstr + strlen (errstr ), 0 );
5179
5201
PerlIO_printf (Perl_debug_log , "'\n" );
5180
5202
}
5181
5203
5182
- #endif
5204
+ # endif
5205
+ #endif /* End of does have locale messages */
5183
5206
5184
5207
SAVEFREEPV (errstr );
5185
5208
return errstr ;
@@ -5301,10 +5324,17 @@ L<C<Perl_switch_to_global_locale>|perlapi/switch_to_global_locale>.
5301
5324
bool
5302
5325
Perl_sync_locale ()
5303
5326
{
5327
+
5328
+ #ifndef USE_LOCALE
5329
+
5330
+ return TRUE;
5331
+
5332
+ #else
5333
+
5304
5334
const char * newlocale ;
5305
5335
dTHX ;
5306
5336
5307
- #ifdef USE_POSIX_2008_LOCALE
5337
+ # ifdef USE_POSIX_2008_LOCALE
5308
5338
5309
5339
bool was_in_global_locale = FALSE;
5310
5340
locale_t cur_obj = uselocale ((locale_t ) 0 );
@@ -5316,11 +5346,11 @@ Perl_sync_locale()
5316
5346
* will affect the */
5317
5347
if (cur_obj == LC_GLOBAL_LOCALE ) {
5318
5348
5319
- # ifdef HAS_QUERY_LOCALE
5349
+ # ifdef HAS_QUERY_LOCALE
5320
5350
5321
5351
do_setlocale_c (LC_ALL , setlocale (LC_ALL , NULL ));
5322
5352
5323
- # else
5353
+ # else
5324
5354
5325
5355
unsigned int i ;
5326
5356
@@ -5330,17 +5360,17 @@ Perl_sync_locale()
5330
5360
do_setlocale_r (categories [i ], setlocale (categories [i ], NULL ));
5331
5361
}
5332
5362
5333
- # endif
5363
+ # endif
5334
5364
5335
5365
was_in_global_locale = TRUE;
5336
5366
}
5337
5367
5338
- #else
5368
+ # else
5339
5369
5340
5370
bool was_in_global_locale = TRUE;
5341
5371
5342
- #endif
5343
- #ifdef USE_LOCALE_CTYPE
5372
+ # endif
5373
+ # ifdef USE_LOCALE_CTYPE
5344
5374
5345
5375
newlocale = savepv (do_setlocale_c (LC_CTYPE , NULL ));
5346
5376
DEBUG_Lv (PerlIO_printf (Perl_debug_log ,
@@ -5349,8 +5379,8 @@ Perl_sync_locale()
5349
5379
new_ctype (newlocale );
5350
5380
Safefree (newlocale );
5351
5381
5352
- #endif /* USE_LOCALE_CTYPE */
5353
- #ifdef USE_LOCALE_COLLATE
5382
+ # endif /* USE_LOCALE_CTYPE */
5383
+ # ifdef USE_LOCALE_COLLATE
5354
5384
5355
5385
newlocale = savepv (do_setlocale_c (LC_COLLATE , NULL ));
5356
5386
DEBUG_Lv (PerlIO_printf (Perl_debug_log ,
@@ -5359,8 +5389,8 @@ Perl_sync_locale()
5359
5389
new_collate (newlocale );
5360
5390
Safefree (newlocale );
5361
5391
5362
- #endif
5363
- #ifdef USE_LOCALE_NUMERIC
5392
+ # endif
5393
+ # ifdef USE_LOCALE_NUMERIC
5364
5394
5365
5395
newlocale = savepv (do_setlocale_c (LC_NUMERIC , NULL ));
5366
5396
DEBUG_Lv (PerlIO_printf (Perl_debug_log ,
@@ -5369,9 +5399,12 @@ Perl_sync_locale()
5369
5399
new_numeric (newlocale );
5370
5400
Safefree (newlocale );
5371
5401
5372
- #endif /* USE_LOCALE_NUMERIC */
5402
+ # endif /* USE_LOCALE_NUMERIC */
5373
5403
5374
5404
return was_in_global_locale ;
5405
+
5406
+ #endif
5407
+
5375
5408
}
5376
5409
5377
5410
#if defined(DEBUGGING ) && defined(USE_LOCALE )
0 commit comments