mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Remove provider field from pg_locale_t.
The behavior of pg_locale_t is specified by methods, so a separate provider field is no longer necessary. Reviewed-by: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/2830211e1b6e6a2e26d845780b03e125281ea17b.camel%40j-davis.com
This commit is contained in:
@@ -240,7 +240,6 @@ create_pg_locale_builtin(Oid collid, MemoryContext context)
|
|||||||
|
|
||||||
result->info.builtin.locale = MemoryContextStrdup(context, locstr);
|
result->info.builtin.locale = MemoryContextStrdup(context, locstr);
|
||||||
result->info.builtin.casemap_full = (strcmp(locstr, "PG_UNICODE_FAST") == 0);
|
result->info.builtin.casemap_full = (strcmp(locstr, "PG_UNICODE_FAST") == 0);
|
||||||
result->provider = COLLPROVIDER_BUILTIN;
|
|
||||||
result->deterministic = true;
|
result->deterministic = true;
|
||||||
result->collate_is_c = true;
|
result->collate_is_c = true;
|
||||||
result->ctype_is_c = (strcmp(locstr, "C") == 0);
|
result->ctype_is_c = (strcmp(locstr, "C") == 0);
|
||||||
|
@@ -292,7 +292,6 @@ create_pg_locale_icu(Oid collid, MemoryContext context)
|
|||||||
result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct));
|
result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct));
|
||||||
result->info.icu.locale = MemoryContextStrdup(context, iculocstr);
|
result->info.icu.locale = MemoryContextStrdup(context, iculocstr);
|
||||||
result->info.icu.ucol = collator;
|
result->info.icu.ucol = collator;
|
||||||
result->provider = COLLPROVIDER_ICU;
|
|
||||||
result->deterministic = deterministic;
|
result->deterministic = deterministic;
|
||||||
result->collate_is_c = false;
|
result->collate_is_c = false;
|
||||||
result->ctype_is_c = false;
|
result->ctype_is_c = false;
|
||||||
@@ -569,8 +568,6 @@ strncoll_icu_utf8(const char *arg1, ssize_t len1, const char *arg2, ssize_t len2
|
|||||||
int result;
|
int result;
|
||||||
UErrorCode status;
|
UErrorCode status;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_ICU);
|
|
||||||
|
|
||||||
Assert(GetDatabaseEncoding() == PG_UTF8);
|
Assert(GetDatabaseEncoding() == PG_UTF8);
|
||||||
|
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
@@ -598,8 +595,6 @@ strnxfrm_icu(char *dest, size_t destsize, const char *src, ssize_t srclen,
|
|||||||
size_t uchar_bsize;
|
size_t uchar_bsize;
|
||||||
Size result_bsize;
|
Size result_bsize;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_ICU);
|
|
||||||
|
|
||||||
init_icu_converter();
|
init_icu_converter();
|
||||||
|
|
||||||
ulen = uchar_length(icu_converter, src, srclen);
|
ulen = uchar_length(icu_converter, src, srclen);
|
||||||
@@ -644,8 +639,6 @@ strnxfrm_prefix_icu_utf8(char *dest, size_t destsize,
|
|||||||
uint32_t state[2];
|
uint32_t state[2];
|
||||||
UErrorCode status;
|
UErrorCode status;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_ICU);
|
|
||||||
|
|
||||||
Assert(GetDatabaseEncoding() == PG_UTF8);
|
Assert(GetDatabaseEncoding() == PG_UTF8);
|
||||||
|
|
||||||
uiter_setUTF8(&iter, src, srclen);
|
uiter_setUTF8(&iter, src, srclen);
|
||||||
@@ -844,8 +837,6 @@ strncoll_icu(const char *arg1, ssize_t len1,
|
|||||||
*uchar2;
|
*uchar2;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_ICU);
|
|
||||||
|
|
||||||
/* if encoding is UTF8, use more efficient strncoll_icu_utf8 */
|
/* if encoding is UTF8, use more efficient strncoll_icu_utf8 */
|
||||||
#ifdef HAVE_UCOL_STRCOLLUTF8
|
#ifdef HAVE_UCOL_STRCOLLUTF8
|
||||||
Assert(GetDatabaseEncoding() != PG_UTF8);
|
Assert(GetDatabaseEncoding() != PG_UTF8);
|
||||||
@@ -894,8 +885,6 @@ strnxfrm_prefix_icu(char *dest, size_t destsize,
|
|||||||
size_t uchar_bsize;
|
size_t uchar_bsize;
|
||||||
Size result_bsize;
|
Size result_bsize;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_ICU);
|
|
||||||
|
|
||||||
/* if encoding is UTF8, use more efficient strnxfrm_prefix_icu_utf8 */
|
/* if encoding is UTF8, use more efficient strnxfrm_prefix_icu_utf8 */
|
||||||
Assert(GetDatabaseEncoding() != PG_UTF8);
|
Assert(GetDatabaseEncoding() != PG_UTF8);
|
||||||
|
|
||||||
|
@@ -713,7 +713,6 @@ create_pg_locale_libc(Oid collid, MemoryContext context)
|
|||||||
loc = make_libc_collator(collate, ctype);
|
loc = make_libc_collator(collate, ctype);
|
||||||
|
|
||||||
result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct));
|
result = MemoryContextAllocZero(context, sizeof(struct pg_locale_struct));
|
||||||
result->provider = COLLPROVIDER_LIBC;
|
|
||||||
result->deterministic = true;
|
result->deterministic = true;
|
||||||
result->collate_is_c = (strcmp(collate, "C") == 0) ||
|
result->collate_is_c = (strcmp(collate, "C") == 0) ||
|
||||||
(strcmp(collate, "POSIX") == 0);
|
(strcmp(collate, "POSIX") == 0);
|
||||||
@@ -833,8 +832,6 @@ strncoll_libc(const char *arg1, ssize_t len1, const char *arg2, ssize_t len2,
|
|||||||
const char *arg2n;
|
const char *arg2n;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_LIBC);
|
|
||||||
|
|
||||||
if (bufsize1 + bufsize2 > TEXTBUFLEN)
|
if (bufsize1 + bufsize2 > TEXTBUFLEN)
|
||||||
buf = palloc(bufsize1 + bufsize2);
|
buf = palloc(bufsize1 + bufsize2);
|
||||||
|
|
||||||
@@ -889,8 +886,6 @@ strnxfrm_libc(char *dest, size_t destsize, const char *src, ssize_t srclen,
|
|||||||
size_t bufsize = srclen + 1;
|
size_t bufsize = srclen + 1;
|
||||||
size_t result;
|
size_t result;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_LIBC);
|
|
||||||
|
|
||||||
if (srclen == -1)
|
if (srclen == -1)
|
||||||
return strxfrm_l(dest, src, destsize, locale->info.lt);
|
return strxfrm_l(dest, src, destsize, locale->info.lt);
|
||||||
|
|
||||||
@@ -999,7 +994,6 @@ strncoll_libc_win32_utf8(const char *arg1, ssize_t len1, const char *arg2,
|
|||||||
int r;
|
int r;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
Assert(locale->provider == COLLPROVIDER_LIBC);
|
|
||||||
Assert(GetDatabaseEncoding() == PG_UTF8);
|
Assert(GetDatabaseEncoding() == PG_UTF8);
|
||||||
|
|
||||||
if (len1 == -1)
|
if (len1 == -1)
|
||||||
|
@@ -143,7 +143,6 @@ struct ctype_methods
|
|||||||
*/
|
*/
|
||||||
struct pg_locale_struct
|
struct pg_locale_struct
|
||||||
{
|
{
|
||||||
char provider;
|
|
||||||
bool deterministic;
|
bool deterministic;
|
||||||
bool collate_is_c;
|
bool collate_is_c;
|
||||||
bool ctype_is_c;
|
bool ctype_is_c;
|
||||||
|
Reference in New Issue
Block a user