mirror of
https://github.com/postgres/postgres.git
synced 2025-06-05 23:56:58 +03:00
Remove pg_regex_collation
We can also use the existing pg_regex_locale as the cache key, which is the only use of this variable. Reviewed-by: Jeff Davis <pgsql@j-davis.com> Discussion: https://www.postgresql.org/message-id/flat/b1b92ae1-2e06-4619-a87a-4b4858e547ec%40eisentraut.org
This commit is contained in:
parent
71cb352904
commit
792b2c7e6d
@ -74,7 +74,6 @@ typedef enum
|
|||||||
|
|
||||||
static PG_Locale_Strategy pg_regex_strategy;
|
static PG_Locale_Strategy pg_regex_strategy;
|
||||||
static pg_locale_t pg_regex_locale;
|
static pg_locale_t pg_regex_locale;
|
||||||
static Oid pg_regex_collation;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hard-wired character properties for C locale
|
* Hard-wired character properties for C locale
|
||||||
@ -254,7 +253,7 @@ pg_set_regex_collation(Oid collation)
|
|||||||
* pg_newlocale_from_collation().
|
* pg_newlocale_from_collation().
|
||||||
*/
|
*/
|
||||||
strategy = PG_REGEX_STRATEGY_C;
|
strategy = PG_REGEX_STRATEGY_C;
|
||||||
collation = C_COLLATION_OID;
|
locale = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -273,7 +272,6 @@ pg_set_regex_collation(Oid collation)
|
|||||||
*/
|
*/
|
||||||
strategy = PG_REGEX_STRATEGY_C;
|
strategy = PG_REGEX_STRATEGY_C;
|
||||||
locale = 0;
|
locale = 0;
|
||||||
collation = C_COLLATION_OID;
|
|
||||||
}
|
}
|
||||||
else if (locale->provider == COLLPROVIDER_BUILTIN)
|
else if (locale->provider == COLLPROVIDER_BUILTIN)
|
||||||
{
|
{
|
||||||
@ -298,7 +296,6 @@ pg_set_regex_collation(Oid collation)
|
|||||||
|
|
||||||
pg_regex_strategy = strategy;
|
pg_regex_strategy = strategy;
|
||||||
pg_regex_locale = locale;
|
pg_regex_locale = locale;
|
||||||
pg_regex_collation = collation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -628,7 +625,7 @@ typedef int (*pg_wc_probefunc) (pg_wchar c);
|
|||||||
typedef struct pg_ctype_cache
|
typedef struct pg_ctype_cache
|
||||||
{
|
{
|
||||||
pg_wc_probefunc probefunc; /* pg_wc_isalpha or a sibling */
|
pg_wc_probefunc probefunc; /* pg_wc_isalpha or a sibling */
|
||||||
Oid collation; /* collation this entry is for */
|
pg_locale_t locale; /* locale this entry is for */
|
||||||
struct cvec cv; /* cache entry contents */
|
struct cvec cv; /* cache entry contents */
|
||||||
struct pg_ctype_cache *next; /* chain link */
|
struct pg_ctype_cache *next; /* chain link */
|
||||||
} pg_ctype_cache;
|
} pg_ctype_cache;
|
||||||
@ -697,7 +694,7 @@ pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
|
|||||||
for (pcc = pg_ctype_cache_list; pcc != NULL; pcc = pcc->next)
|
for (pcc = pg_ctype_cache_list; pcc != NULL; pcc = pcc->next)
|
||||||
{
|
{
|
||||||
if (pcc->probefunc == probefunc &&
|
if (pcc->probefunc == probefunc &&
|
||||||
pcc->collation == pg_regex_collation)
|
pcc->locale == pg_regex_locale)
|
||||||
return &pcc->cv;
|
return &pcc->cv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,7 +705,7 @@ pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
|
|||||||
if (pcc == NULL)
|
if (pcc == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
pcc->probefunc = probefunc;
|
pcc->probefunc = probefunc;
|
||||||
pcc->collation = pg_regex_collation;
|
pcc->locale = pg_regex_locale;
|
||||||
pcc->cv.nchrs = 0;
|
pcc->cv.nchrs = 0;
|
||||||
pcc->cv.chrspace = 128;
|
pcc->cv.chrspace = 128;
|
||||||
pcc->cv.chrs = (chr *) malloc(pcc->cv.chrspace * sizeof(chr));
|
pcc->cv.chrs = (chr *) malloc(pcc->cv.chrspace * sizeof(chr));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user