Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 792b2c7

Browse files
committed
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
1 parent 71cb352 commit 792b2c7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/backend/regex/regc_pg_locale.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ typedef enum
7474

7575
static PG_Locale_Strategy pg_regex_strategy;
7676
static pg_locale_t pg_regex_locale;
77-
static Oid pg_regex_collation;
7877

7978
/*
8079
* Hard-wired character properties for C locale
@@ -254,7 +253,7 @@ pg_set_regex_collation(Oid collation)
254253
* pg_newlocale_from_collation().
255254
*/
256255
strategy = PG_REGEX_STRATEGY_C;
257-
collation = C_COLLATION_OID;
256+
locale = 0;
258257
}
259258
else
260259
{
@@ -273,7 +272,6 @@ pg_set_regex_collation(Oid collation)
273272
*/
274273
strategy = PG_REGEX_STRATEGY_C;
275274
locale = 0;
276-
collation = C_COLLATION_OID;
277275
}
278276
else if (locale->provider == COLLPROVIDER_BUILTIN)
279277
{
@@ -298,7 +296,6 @@ pg_set_regex_collation(Oid collation)
298296

299297
pg_regex_strategy = strategy;
300298
pg_regex_locale = locale;
301-
pg_regex_collation = collation;
302299
}
303300

304301
static int
@@ -628,7 +625,7 @@ typedef int (*pg_wc_probefunc) (pg_wchar c);
628625
typedef struct pg_ctype_cache
629626
{
630627
pg_wc_probefunc probefunc; /* pg_wc_isalpha or a sibling */
631-
Oid collation; /* collation this entry is for */
628+
pg_locale_t locale; /* locale this entry is for */
632629
struct cvec cv; /* cache entry contents */
633630
struct pg_ctype_cache *next; /* chain link */
634631
} pg_ctype_cache;
@@ -697,7 +694,7 @@ pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
697694
for (pcc = pg_ctype_cache_list; pcc != NULL; pcc = pcc->next)
698695
{
699696
if (pcc->probefunc == probefunc &&
700-
pcc->collation == pg_regex_collation)
697+
pcc->locale == pg_regex_locale)
701698
return &pcc->cv;
702699
}
703700

@@ -708,7 +705,7 @@ pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
708705
if (pcc == NULL)
709706
return NULL;
710707
pcc->probefunc = probefunc;
711-
pcc->collation = pg_regex_collation;
708+
pcc->locale = pg_regex_locale;
712709
pcc->cv.nchrs = 0;
713710
pcc->cv.chrspace = 128;
714711
pcc->cv.chrs = (chr *) malloc(pcc->cv.chrspace * sizeof(chr));

0 commit comments

Comments
 (0)