4444 * the platform's wchar_t representation matches what we do in pg_wchar
4545 * conversions.
4646 *
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>
4948 * functions, under exactly the same cases as #2.
5049 *
5150 * There is one notable difference between cases 2 and 3: in the "default"
@@ -252,11 +251,6 @@ pg_set_regex_collation(Oid collation)
252251 }
253252 else
254253 {
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- */
260254 pg_regex_locale = pg_newlocale_from_collation (collation );
261255
262256 if (!pg_locale_deterministic (pg_regex_locale ))
@@ -304,16 +298,12 @@ pg_wc_isdigit(pg_wchar c)
304298 return (c <= (pg_wchar ) UCHAR_MAX &&
305299 isdigit ((unsigned char ) c ));
306300 case PG_REGEX_LOCALE_WIDE_L :
307- #ifdef HAVE_LOCALE_T
308301 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
309302 return iswdigit_l ((wint_t ) c , pg_regex_locale -> info .lt );
310- #endif
311303 /* FALL THRU */
312304 case PG_REGEX_LOCALE_1BYTE_L :
313- #ifdef HAVE_LOCALE_T
314305 return (c <= (pg_wchar ) UCHAR_MAX &&
315306 isdigit_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
316- #endif
317307 break ;
318308 case PG_REGEX_LOCALE_ICU :
319309#ifdef USE_ICU
@@ -340,16 +330,12 @@ pg_wc_isalpha(pg_wchar c)
340330 return (c <= (pg_wchar ) UCHAR_MAX &&
341331 isalpha ((unsigned char ) c ));
342332 case PG_REGEX_LOCALE_WIDE_L :
343- #ifdef HAVE_LOCALE_T
344333 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
345334 return iswalpha_l ((wint_t ) c , pg_regex_locale -> info .lt );
346- #endif
347335 /* FALL THRU */
348336 case PG_REGEX_LOCALE_1BYTE_L :
349- #ifdef HAVE_LOCALE_T
350337 return (c <= (pg_wchar ) UCHAR_MAX &&
351338 isalpha_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
352- #endif
353339 break ;
354340 case PG_REGEX_LOCALE_ICU :
355341#ifdef USE_ICU
@@ -376,16 +362,12 @@ pg_wc_isalnum(pg_wchar c)
376362 return (c <= (pg_wchar ) UCHAR_MAX &&
377363 isalnum ((unsigned char ) c ));
378364 case PG_REGEX_LOCALE_WIDE_L :
379- #ifdef HAVE_LOCALE_T
380365 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
381366 return iswalnum_l ((wint_t ) c , pg_regex_locale -> info .lt );
382- #endif
383367 /* FALL THRU */
384368 case PG_REGEX_LOCALE_1BYTE_L :
385- #ifdef HAVE_LOCALE_T
386369 return (c <= (pg_wchar ) UCHAR_MAX &&
387370 isalnum_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
388- #endif
389371 break ;
390372 case PG_REGEX_LOCALE_ICU :
391373#ifdef USE_ICU
@@ -421,16 +403,12 @@ pg_wc_isupper(pg_wchar c)
421403 return (c <= (pg_wchar ) UCHAR_MAX &&
422404 isupper ((unsigned char ) c ));
423405 case PG_REGEX_LOCALE_WIDE_L :
424- #ifdef HAVE_LOCALE_T
425406 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
426407 return iswupper_l ((wint_t ) c , pg_regex_locale -> info .lt );
427- #endif
428408 /* FALL THRU */
429409 case PG_REGEX_LOCALE_1BYTE_L :
430- #ifdef HAVE_LOCALE_T
431410 return (c <= (pg_wchar ) UCHAR_MAX &&
432411 isupper_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
433- #endif
434412 break ;
435413 case PG_REGEX_LOCALE_ICU :
436414#ifdef USE_ICU
@@ -457,16 +435,12 @@ pg_wc_islower(pg_wchar c)
457435 return (c <= (pg_wchar ) UCHAR_MAX &&
458436 islower ((unsigned char ) c ));
459437 case PG_REGEX_LOCALE_WIDE_L :
460- #ifdef HAVE_LOCALE_T
461438 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
462439 return iswlower_l ((wint_t ) c , pg_regex_locale -> info .lt );
463- #endif
464440 /* FALL THRU */
465441 case PG_REGEX_LOCALE_1BYTE_L :
466- #ifdef HAVE_LOCALE_T
467442 return (c <= (pg_wchar ) UCHAR_MAX &&
468443 islower_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
469- #endif
470444 break ;
471445 case PG_REGEX_LOCALE_ICU :
472446#ifdef USE_ICU
@@ -493,16 +467,12 @@ pg_wc_isgraph(pg_wchar c)
493467 return (c <= (pg_wchar ) UCHAR_MAX &&
494468 isgraph ((unsigned char ) c ));
495469 case PG_REGEX_LOCALE_WIDE_L :
496- #ifdef HAVE_LOCALE_T
497470 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
498471 return iswgraph_l ((wint_t ) c , pg_regex_locale -> info .lt );
499- #endif
500472 /* FALL THRU */
501473 case PG_REGEX_LOCALE_1BYTE_L :
502- #ifdef HAVE_LOCALE_T
503474 return (c <= (pg_wchar ) UCHAR_MAX &&
504475 isgraph_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
505- #endif
506476 break ;
507477 case PG_REGEX_LOCALE_ICU :
508478#ifdef USE_ICU
@@ -529,16 +499,12 @@ pg_wc_isprint(pg_wchar c)
529499 return (c <= (pg_wchar ) UCHAR_MAX &&
530500 isprint ((unsigned char ) c ));
531501 case PG_REGEX_LOCALE_WIDE_L :
532- #ifdef HAVE_LOCALE_T
533502 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
534503 return iswprint_l ((wint_t ) c , pg_regex_locale -> info .lt );
535- #endif
536504 /* FALL THRU */
537505 case PG_REGEX_LOCALE_1BYTE_L :
538- #ifdef HAVE_LOCALE_T
539506 return (c <= (pg_wchar ) UCHAR_MAX &&
540507 isprint_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
541- #endif
542508 break ;
543509 case PG_REGEX_LOCALE_ICU :
544510#ifdef USE_ICU
@@ -565,16 +531,12 @@ pg_wc_ispunct(pg_wchar c)
565531 return (c <= (pg_wchar ) UCHAR_MAX &&
566532 ispunct ((unsigned char ) c ));
567533 case PG_REGEX_LOCALE_WIDE_L :
568- #ifdef HAVE_LOCALE_T
569534 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
570535 return iswpunct_l ((wint_t ) c , pg_regex_locale -> info .lt );
571- #endif
572536 /* FALL THRU */
573537 case PG_REGEX_LOCALE_1BYTE_L :
574- #ifdef HAVE_LOCALE_T
575538 return (c <= (pg_wchar ) UCHAR_MAX &&
576539 ispunct_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
577- #endif
578540 break ;
579541 case PG_REGEX_LOCALE_ICU :
580542#ifdef USE_ICU
@@ -601,16 +563,12 @@ pg_wc_isspace(pg_wchar c)
601563 return (c <= (pg_wchar ) UCHAR_MAX &&
602564 isspace ((unsigned char ) c ));
603565 case PG_REGEX_LOCALE_WIDE_L :
604- #ifdef HAVE_LOCALE_T
605566 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
606567 return iswspace_l ((wint_t ) c , pg_regex_locale -> info .lt );
607- #endif
608568 /* FALL THRU */
609569 case PG_REGEX_LOCALE_1BYTE_L :
610- #ifdef HAVE_LOCALE_T
611570 return (c <= (pg_wchar ) UCHAR_MAX &&
612571 isspace_l ((unsigned char ) c , pg_regex_locale -> info .lt ));
613- #endif
614572 break ;
615573 case PG_REGEX_LOCALE_ICU :
616574#ifdef USE_ICU
@@ -645,16 +603,12 @@ pg_wc_toupper(pg_wchar c)
645603 return toupper ((unsigned char ) c );
646604 return c ;
647605 case PG_REGEX_LOCALE_WIDE_L :
648- #ifdef HAVE_LOCALE_T
649606 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
650607 return towupper_l ((wint_t ) c , pg_regex_locale -> info .lt );
651- #endif
652608 /* FALL THRU */
653609 case PG_REGEX_LOCALE_1BYTE_L :
654- #ifdef HAVE_LOCALE_T
655610 if (c <= (pg_wchar ) UCHAR_MAX )
656611 return toupper_l ((unsigned char ) c , pg_regex_locale -> info .lt );
657- #endif
658612 return c ;
659613 case PG_REGEX_LOCALE_ICU :
660614#ifdef USE_ICU
@@ -689,16 +643,12 @@ pg_wc_tolower(pg_wchar c)
689643 return tolower ((unsigned char ) c );
690644 return c ;
691645 case PG_REGEX_LOCALE_WIDE_L :
692- #ifdef HAVE_LOCALE_T
693646 if (sizeof (wchar_t ) >= 4 || c <= (pg_wchar ) 0xFFFF )
694647 return towlower_l ((wint_t ) c , pg_regex_locale -> info .lt );
695- #endif
696648 /* FALL THRU */
697649 case PG_REGEX_LOCALE_1BYTE_L :
698- #ifdef HAVE_LOCALE_T
699650 if (c <= (pg_wchar ) UCHAR_MAX )
700651 return tolower_l ((unsigned char ) c , pg_regex_locale -> info .lt );
701- #endif
702652 return c ;
703653 case PG_REGEX_LOCALE_ICU :
704654#ifdef USE_ICU
0 commit comments