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

Function uchar_length

pg_documentdb_core/src/collation/collation.c:1026–1039  ·  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 * Find length, in UChars, of given string if converted to UChar string. */

Source from the content-addressed store, hash-verified

1024 * Find length, in UChars, of given string if converted to UChar string.
1025 */
1026static size_t
1027uchar_length(UConverter *converter, const char *str, int32_t len)
1028{
1029 UErrorCode status = U_ZERO_ERROR;
1030 int32_t ulen;
1031
1032 ulen = ucnv_toUChars(converter, NULL, 0, str, len, &status);
1033 if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
1034 {
1035 ereport(ERROR,
1036 (errmsg("%s failed: %s", "ucnv_toUChars", u_errorName(status))));
1037 }
1038 return ulen;
1039}
1040
1041
1042/*

Callers 1

icu_to_uchar_coreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected