44
44
* the platform's wchar_t representation matches what we do in pg_wchar
45
45
* conversions.
46
46
*
47
- * 3. Other collations are only supported on platforms that HAVE_LOCALE_T.
48
- * Here, we use the locale_t-extended forms of the <wctype.h> and <ctype.h>
47
+ * 3. Here, we use the locale_t-extended forms of the <wctype.h> and <ctype.h>
49
48
* functions, under exactly the same cases as #2.
50
49
*
51
50
* There is one notable difference between cases 2 and 3: in the "default"
@@ -252,11 +251,6 @@ pg_set_regex_collation(Oid collation)
252
251
}
253
252
else
254
253
{
255
- /*
256
- * NB: pg_newlocale_from_collation will fail if not HAVE_LOCALE_T; the
257
- * case of pg_regex_locale != 0 but not HAVE_LOCALE_T does not have to
258
- * be considered below.
259
- */
260
254
pg_regex_locale = pg_newlocale_from_collation (collation );
261
255
262
256
if (!pg_locale_deterministic (pg_regex_locale ))
@@ -304,16 +298,12 @@ pg_wc_isdigit(pg_wchar c)
304
298
return (c <= (pg_wchar ) UCHAR_MAX &&
305
299
isdigit ((unsigned char ) c ));
306
300
case PG_REGEX_LOCALE_WIDE_L :
307
- #ifdef HAVE_LOCALE_T
308
301
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
309
302
return iswdigit_l ((wint_t ) c , pg_regex_locale -> info .lt );
310
- #endif
311
303
/* FALL THRU */
312
304
case PG_REGEX_LOCALE_1BYTE_L :
313
- #ifdef HAVE_LOCALE_T
314
305
return (c <= (pg_wchar ) UCHAR_MAX &&
315
306
isdigit_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
316
- #endif
317
307
break ;
318
308
case PG_REGEX_LOCALE_ICU :
319
309
#ifdef USE_ICU
@@ -340,16 +330,12 @@ pg_wc_isalpha(pg_wchar c)
340
330
return (c <= (pg_wchar ) UCHAR_MAX &&
341
331
isalpha ((unsigned char ) c ));
342
332
case PG_REGEX_LOCALE_WIDE_L :
343
- #ifdef HAVE_LOCALE_T
344
333
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
345
334
return iswalpha_l ((wint_t ) c , pg_regex_locale -> info .lt );
346
- #endif
347
335
/* FALL THRU */
348
336
case PG_REGEX_LOCALE_1BYTE_L :
349
- #ifdef HAVE_LOCALE_T
350
337
return (c <= (pg_wchar ) UCHAR_MAX &&
351
338
isalpha_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
352
- #endif
353
339
break ;
354
340
case PG_REGEX_LOCALE_ICU :
355
341
#ifdef USE_ICU
@@ -376,16 +362,12 @@ pg_wc_isalnum(pg_wchar c)
376
362
return (c <= (pg_wchar ) UCHAR_MAX &&
377
363
isalnum ((unsigned char ) c ));
378
364
case PG_REGEX_LOCALE_WIDE_L :
379
- #ifdef HAVE_LOCALE_T
380
365
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
381
366
return iswalnum_l ((wint_t ) c , pg_regex_locale -> info .lt );
382
- #endif
383
367
/* FALL THRU */
384
368
case PG_REGEX_LOCALE_1BYTE_L :
385
- #ifdef HAVE_LOCALE_T
386
369
return (c <= (pg_wchar ) UCHAR_MAX &&
387
370
isalnum_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
388
- #endif
389
371
break ;
390
372
case PG_REGEX_LOCALE_ICU :
391
373
#ifdef USE_ICU
@@ -421,16 +403,12 @@ pg_wc_isupper(pg_wchar c)
421
403
return (c <= (pg_wchar ) UCHAR_MAX &&
422
404
isupper ((unsigned char ) c ));
423
405
case PG_REGEX_LOCALE_WIDE_L :
424
- #ifdef HAVE_LOCALE_T
425
406
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
426
407
return iswupper_l ((wint_t ) c , pg_regex_locale -> info .lt );
427
- #endif
428
408
/* FALL THRU */
429
409
case PG_REGEX_LOCALE_1BYTE_L :
430
- #ifdef HAVE_LOCALE_T
431
410
return (c <= (pg_wchar ) UCHAR_MAX &&
432
411
isupper_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
433
- #endif
434
412
break ;
435
413
case PG_REGEX_LOCALE_ICU :
436
414
#ifdef USE_ICU
@@ -457,16 +435,12 @@ pg_wc_islower(pg_wchar c)
457
435
return (c <= (pg_wchar ) UCHAR_MAX &&
458
436
islower ((unsigned char ) c ));
459
437
case PG_REGEX_LOCALE_WIDE_L :
460
- #ifdef HAVE_LOCALE_T
461
438
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
462
439
return iswlower_l ((wint_t ) c , pg_regex_locale -> info .lt );
463
- #endif
464
440
/* FALL THRU */
465
441
case PG_REGEX_LOCALE_1BYTE_L :
466
- #ifdef HAVE_LOCALE_T
467
442
return (c <= (pg_wchar ) UCHAR_MAX &&
468
443
islower_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
469
- #endif
470
444
break ;
471
445
case PG_REGEX_LOCALE_ICU :
472
446
#ifdef USE_ICU
@@ -493,16 +467,12 @@ pg_wc_isgraph(pg_wchar c)
493
467
return (c <= (pg_wchar ) UCHAR_MAX &&
494
468
isgraph ((unsigned char ) c ));
495
469
case PG_REGEX_LOCALE_WIDE_L :
496
- #ifdef HAVE_LOCALE_T
497
470
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
498
471
return iswgraph_l ((wint_t ) c , pg_regex_locale -> info .lt );
499
- #endif
500
472
/* FALL THRU */
501
473
case PG_REGEX_LOCALE_1BYTE_L :
502
- #ifdef HAVE_LOCALE_T
503
474
return (c <= (pg_wchar ) UCHAR_MAX &&
504
475
isgraph_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
505
- #endif
506
476
break ;
507
477
case PG_REGEX_LOCALE_ICU :
508
478
#ifdef USE_ICU
@@ -529,16 +499,12 @@ pg_wc_isprint(pg_wchar c)
529
499
return (c <= (pg_wchar ) UCHAR_MAX &&
530
500
isprint ((unsigned char ) c ));
531
501
case PG_REGEX_LOCALE_WIDE_L :
532
- #ifdef HAVE_LOCALE_T
533
502
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
534
503
return iswprint_l ((wint_t ) c , pg_regex_locale -> info .lt );
535
- #endif
536
504
/* FALL THRU */
537
505
case PG_REGEX_LOCALE_1BYTE_L :
538
- #ifdef HAVE_LOCALE_T
539
506
return (c <= (pg_wchar ) UCHAR_MAX &&
540
507
isprint_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
541
- #endif
542
508
break ;
543
509
case PG_REGEX_LOCALE_ICU :
544
510
#ifdef USE_ICU
@@ -565,16 +531,12 @@ pg_wc_ispunct(pg_wchar c)
565
531
return (c <= (pg_wchar ) UCHAR_MAX &&
566
532
ispunct ((unsigned char ) c ));
567
533
case PG_REGEX_LOCALE_WIDE_L :
568
- #ifdef HAVE_LOCALE_T
569
534
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
570
535
return iswpunct_l ((wint_t ) c , pg_regex_locale -> info .lt );
571
- #endif
572
536
/* FALL THRU */
573
537
case PG_REGEX_LOCALE_1BYTE_L :
574
- #ifdef HAVE_LOCALE_T
575
538
return (c <= (pg_wchar ) UCHAR_MAX &&
576
539
ispunct_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
577
- #endif
578
540
break ;
579
541
case PG_REGEX_LOCALE_ICU :
580
542
#ifdef USE_ICU
@@ -601,16 +563,12 @@ pg_wc_isspace(pg_wchar c)
601
563
return (c <= (pg_wchar ) UCHAR_MAX &&
602
564
isspace ((unsigned char ) c ));
603
565
case PG_REGEX_LOCALE_WIDE_L :
604
- #ifdef HAVE_LOCALE_T
605
566
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
606
567
return iswspace_l ((wint_t ) c , pg_regex_locale -> info .lt );
607
- #endif
608
568
/* FALL THRU */
609
569
case PG_REGEX_LOCALE_1BYTE_L :
610
- #ifdef HAVE_LOCALE_T
611
570
return (c <= (pg_wchar ) UCHAR_MAX &&
612
571
isspace_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
613
- #endif
614
572
break ;
615
573
case PG_REGEX_LOCALE_ICU :
616
574
#ifdef USE_ICU
@@ -645,16 +603,12 @@ pg_wc_toupper(pg_wchar c)
645
603
return toupper ((unsigned char ) c );
646
604
return c ;
647
605
case PG_REGEX_LOCALE_WIDE_L :
648
- #ifdef HAVE_LOCALE_T
649
606
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
650
607
return towupper_l ((wint_t ) c , pg_regex_locale -> info .lt );
651
- #endif
652
608
/* FALL THRU */
653
609
case PG_REGEX_LOCALE_1BYTE_L :
654
- #ifdef HAVE_LOCALE_T
655
610
if (c <= (pg_wchar ) UCHAR_MAX )
656
611
return toupper_l ((unsigned char ) c , pg_regex_locale -> info .lt );
657
- #endif
658
612
return c ;
659
613
case PG_REGEX_LOCALE_ICU :
660
614
#ifdef USE_ICU
@@ -689,16 +643,12 @@ pg_wc_tolower(pg_wchar c)
689
643
return tolower ((unsigned char ) c );
690
644
return c ;
691
645
case PG_REGEX_LOCALE_WIDE_L :
692
- #ifdef HAVE_LOCALE_T
693
646
if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
694
647
return towlower_l ((wint_t ) c , pg_regex_locale -> info .lt );
695
- #endif
696
648
/* FALL THRU */
697
649
case PG_REGEX_LOCALE_1BYTE_L :
698
- #ifdef HAVE_LOCALE_T
699
650
if (c <= (pg_wchar ) UCHAR_MAX )
700
651
return tolower_l ((unsigned char ) c , pg_regex_locale -> info .lt );
701
- #endif
702
652
return c ;
703
653
case PG_REGEX_LOCALE_ICU :
704
654
#ifdef USE_ICU
0 commit comments