@@ -5798,12 +5798,12 @@ unicode_assigned(PG_FUNCTION_ARGS)
57985798 ereport (ERROR ,
57995799 (errmsg ("Unicode categorization can only be performed if server encoding is UTF8" )));
58005800
5801- /* convert to pg_wchar */
5801+ /* convert to char32_t */
58025802 size = pg_mbstrlen_with_len (VARDATA_ANY (input ), VARSIZE_ANY_EXHDR (input ));
58035803 p = (unsigned char * ) VARDATA_ANY (input );
58045804 for (int i = 0 ; i < size ; i ++ )
58055805 {
5806- pg_wchar uchar = utf8_to_unicode (p );
5806+ char32_t uchar = utf8_to_unicode (p );
58075807 int category = unicode_category (uchar );
58085808
58095809 if (category == PG_U_UNASSIGNED )
@@ -5822,32 +5822,32 @@ unicode_normalize_func(PG_FUNCTION_ARGS)
58225822 char * formstr = text_to_cstring (PG_GETARG_TEXT_PP (1 ));
58235823 UnicodeNormalizationForm form ;
58245824 int size ;
5825- pg_wchar * input_chars ;
5826- pg_wchar * output_chars ;
5825+ char32_t * input_chars ;
5826+ char32_t * output_chars ;
58275827 unsigned char * p ;
58285828 text * result ;
58295829 int i ;
58305830
58315831 form = unicode_norm_form_from_string (formstr );
58325832
5833- /* convert to pg_wchar */
5833+ /* convert to char32_t */
58345834 size = pg_mbstrlen_with_len (VARDATA_ANY (input ), VARSIZE_ANY_EXHDR (input ));
5835- input_chars = palloc ((size + 1 ) * sizeof (pg_wchar ));
5835+ input_chars = palloc ((size + 1 ) * sizeof (char32_t ));
58365836 p = (unsigned char * ) VARDATA_ANY (input );
58375837 for (i = 0 ; i < size ; i ++ )
58385838 {
58395839 input_chars [i ] = utf8_to_unicode (p );
58405840 p += pg_utf_mblen (p );
58415841 }
5842- input_chars [i ] = (pg_wchar ) '\0' ;
5842+ input_chars [i ] = (char32_t ) '\0' ;
58435843 Assert ((char * ) p == VARDATA_ANY (input ) + VARSIZE_ANY_EXHDR (input ));
58445844
58455845 /* action */
58465846 output_chars = unicode_normalize (form , input_chars );
58475847
58485848 /* convert back to UTF-8 string */
58495849 size = 0 ;
5850- for (pg_wchar * wp = output_chars ; * wp ; wp ++ )
5850+ for (char32_t * wp = output_chars ; * wp ; wp ++ )
58515851 {
58525852 unsigned char buf [4 ];
58535853
@@ -5859,7 +5859,7 @@ unicode_normalize_func(PG_FUNCTION_ARGS)
58595859 SET_VARSIZE (result , size + VARHDRSZ );
58605860
58615861 p = (unsigned char * ) VARDATA_ANY (result );
5862- for (pg_wchar * wp = output_chars ; * wp ; wp ++ )
5862+ for (char32_t * wp = output_chars ; * wp ; wp ++ )
58635863 {
58645864 unicode_to_utf8 (* wp , p );
58655865 p += pg_utf_mblen (p );
@@ -5888,8 +5888,8 @@ unicode_is_normalized(PG_FUNCTION_ARGS)
58885888 char * formstr = text_to_cstring (PG_GETARG_TEXT_PP (1 ));
58895889 UnicodeNormalizationForm form ;
58905890 int size ;
5891- pg_wchar * input_chars ;
5892- pg_wchar * output_chars ;
5891+ char32_t * input_chars ;
5892+ char32_t * output_chars ;
58935893 unsigned char * p ;
58945894 int i ;
58955895 UnicodeNormalizationQC quickcheck ;
@@ -5898,16 +5898,16 @@ unicode_is_normalized(PG_FUNCTION_ARGS)
58985898
58995899 form = unicode_norm_form_from_string (formstr );
59005900
5901- /* convert to pg_wchar */
5901+ /* convert to char32_t */
59025902 size = pg_mbstrlen_with_len (VARDATA_ANY (input ), VARSIZE_ANY_EXHDR (input ));
5903- input_chars = palloc ((size + 1 ) * sizeof (pg_wchar ));
5903+ input_chars = palloc ((size + 1 ) * sizeof (char32_t ));
59045904 p = (unsigned char * ) VARDATA_ANY (input );
59055905 for (i = 0 ; i < size ; i ++ )
59065906 {
59075907 input_chars [i ] = utf8_to_unicode (p );
59085908 p += pg_utf_mblen (p );
59095909 }
5910- input_chars [i ] = (pg_wchar ) '\0' ;
5910+ input_chars [i ] = (char32_t ) '\0' ;
59115911 Assert ((char * ) p == VARDATA_ANY (input ) + VARSIZE_ANY_EXHDR (input ));
59125912
59135913 /* quick check (see UAX #15) */
@@ -5921,11 +5921,11 @@ unicode_is_normalized(PG_FUNCTION_ARGS)
59215921 output_chars = unicode_normalize (form , input_chars );
59225922
59235923 output_size = 0 ;
5924- for (pg_wchar * wp = output_chars ; * wp ; wp ++ )
5924+ for (char32_t * wp = output_chars ; * wp ; wp ++ )
59255925 output_size ++ ;
59265926
59275927 result = (size == output_size ) &&
5928- (memcmp (input_chars , output_chars , size * sizeof (pg_wchar )) == 0 );
5928+ (memcmp (input_chars , output_chars , size * sizeof (char32_t )) == 0 );
59295929
59305930 PG_RETURN_BOOL (result );
59315931}
@@ -5981,7 +5981,7 @@ unistr(PG_FUNCTION_ARGS)
59815981 int len ;
59825982 StringInfoData str ;
59835983 text * result ;
5984- pg_wchar pair_first = 0 ;
5984+ char16_t pair_first = 0 ;
59855985 char cbuf [MAX_UNICODE_EQUIVALENT_STRING + 1 ];
59865986
59875987 instr = VARDATA_ANY (input_text );
@@ -6005,7 +6005,7 @@ unistr(PG_FUNCTION_ARGS)
60056005 else if ((len >= 5 && isxdigits_n (instr + 1 , 4 )) ||
60066006 (len >= 6 && instr [1 ] == 'u' && isxdigits_n (instr + 2 , 4 )))
60076007 {
6008- pg_wchar unicode ;
6008+ char32_t unicode ;
60096009 int offset = instr [1 ] == 'u' ? 2 : 1 ;
60106010
60116011 unicode = hexval_n (instr + offset , 4 );
@@ -6041,7 +6041,7 @@ unistr(PG_FUNCTION_ARGS)
60416041 }
60426042 else if (len >= 8 && instr [1 ] == '+' && isxdigits_n (instr + 2 , 6 ))
60436043 {
6044- pg_wchar unicode ;
6044+ char32_t unicode ;
60456045
60466046 unicode = hexval_n (instr + 2 , 6 );
60476047
@@ -6076,7 +6076,7 @@ unistr(PG_FUNCTION_ARGS)
60766076 }
60776077 else if (len >= 10 && instr [1 ] == 'U' && isxdigits_n (instr + 2 , 8 ))
60786078 {
6079- pg_wchar unicode ;
6079+ char32_t unicode ;
60806080
60816081 unicode = hexval_n (instr + 2 , 8 );
60826082
0 commit comments