mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Refactor to introduce pg_locale_deterministic().
Avoids the need of callers to test for NULL, and also avoids the need to access the pg_locale_t structure directly. Reviewed-by: Peter Eisentraut, Peter Geoghegan Discussion: https://postgr.es/m/a581136455c940d7bd0ff482d3a2bd51af25a94f.camel%40j-davis.com
This commit is contained in:
@@ -762,7 +762,7 @@ bpchareq(PG_FUNCTION_ARGS)
|
||||
else
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (locale_is_c || !mylocale || mylocale->deterministic)
|
||||
if (locale_is_c || pg_locale_deterministic(mylocale))
|
||||
{
|
||||
/*
|
||||
* Since we only care about equality or not-equality, we can avoid all
|
||||
@@ -807,7 +807,7 @@ bpcharne(PG_FUNCTION_ARGS)
|
||||
else
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (locale_is_c || !mylocale || mylocale->deterministic)
|
||||
if (locale_is_c || pg_locale_deterministic(mylocale))
|
||||
{
|
||||
/*
|
||||
* Since we only care about equality or not-equality, we can avoid all
|
||||
@@ -1015,7 +1015,7 @@ hashbpchar(PG_FUNCTION_ARGS)
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (!mylocale || mylocale->deterministic)
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
result = hash_any((unsigned char *) keydata, keylen);
|
||||
}
|
||||
@@ -1077,7 +1077,7 @@ hashbpcharextended(PG_FUNCTION_ARGS)
|
||||
if (!lc_collate_is_c(collid))
|
||||
mylocale = pg_newlocale_from_collation(collid);
|
||||
|
||||
if (!mylocale || mylocale->deterministic)
|
||||
if (pg_locale_deterministic(mylocale))
|
||||
{
|
||||
result = hash_any_extended((unsigned char *) keydata, keylen,
|
||||
PG_GETARG_INT64(1));
|
||||
|
||||
Reference in New Issue
Block a user