MCPcopy Create free account
hub / github.com/documentdb/documentdb / icu_to_uchar_core

Function icu_to_uchar_core

pg_documentdb_core/src/collation/collation.c:1080–1094  ·  view source on GitHub ↗

* Ported from pg_locale.c in Postgres 17: * See https://github.com/postgres/postgres/blob/REL_17_STABLE/src/backend/utils/adt/pg_locale.c#L2758 * Convert a string in the database encoding into a string of UChars. * * The source string at buff is of length nbytes * (it needn't be nul-terminated) * * *buff_uchar receives a pointer to the palloc'd result string, and * the function's result is

Source from the content-addressed store, hash-verified

1078 * result length instead.
1079 */
1080static int32_t
1081icu_to_uchar_core(UChar **buff_uchar, const char *buff, size_t nbytes)
1082{
1083 int32_t len_uchar;
1084
1085 init_icu_converter();
1086
1087 len_uchar = uchar_length(icu_converter, buff, nbytes);
1088
1089 *buff_uchar = palloc((len_uchar + 1) * sizeof(**buff_uchar));
1090 len_uchar = uchar_convert(icu_converter,
1091 *buff_uchar, len_uchar + 1, buff, nbytes);
1092
1093 return len_uchar;
1094}

Callers 1

GetCollationSortKeyFunction · 0.85

Calls 3

init_icu_converterFunction · 0.85
uchar_lengthFunction · 0.85
uchar_convertFunction · 0.85

Tested by

no test coverage detected