mirror of
https://github.com/postgres/postgres.git
synced 2025-05-20 05:13:53 +03:00
Remove unnecessary #ifdef USE_ICU and branch.
Now that the provider-independent API pg_strnxfrm() is available, we no longer need the special cases for ICU in hashfunc.c and varchar.c. Reviewed-by: Peter Eisentraut, Peter Geoghegan Discussion: https://postgr.es/m/a581136455c940d7bd0ff482d3a2bd51af25a94f.camel%40j-davis.com
This commit is contained in:
parent
6974a8f768
commit
e0b3074e89
@ -288,15 +288,13 @@ hashtext(PG_FUNCTION_ARGS)
|
||||
VARSIZE_ANY_EXHDR(key));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_ICU
|
||||
if (mylocale->provider == COLLPROVIDER_ICU)
|
||||
{
|
||||
Size bsize, rsize;
|
||||
char *buf;
|
||||
const char *keydata = VARDATA_ANY(key);
|
||||
size_t keylen = VARSIZE_ANY_EXHDR(key);
|
||||
|
||||
|
||||
bsize = pg_strnxfrm(NULL, 0, keydata, keylen, mylocale);
|
||||
buf = palloc(bsize + 1);
|
||||
|
||||
@ -313,11 +311,6 @@ hashtext(PG_FUNCTION_ARGS)
|
||||
|
||||
pfree(buf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* shouldn't happen */
|
||||
elog(ERROR, "unsupported collprovider: %c", mylocale->provider);
|
||||
}
|
||||
|
||||
/* Avoid leaking memory for toasted inputs */
|
||||
PG_FREE_IF_COPY(key, 0);
|
||||
@ -349,9 +342,6 @@ hashtextextended(PG_FUNCTION_ARGS)
|
||||
PG_GETARG_INT64(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_ICU
|
||||
if (mylocale->provider == COLLPROVIDER_ICU)
|
||||
{
|
||||
Size bsize, rsize;
|
||||
char *buf;
|
||||
@ -375,11 +365,6 @@ hashtextextended(PG_FUNCTION_ARGS)
|
||||
|
||||
pfree(buf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* shouldn't happen */
|
||||
elog(ERROR, "unsupported collprovider: %c", mylocale->provider);
|
||||
}
|
||||
|
||||
PG_FREE_IF_COPY(key, 0);
|
||||
|
||||
|
@ -1020,9 +1020,6 @@ hashbpchar(PG_FUNCTION_ARGS)
|
||||
result = hash_any((unsigned char *) keydata, keylen);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_ICU
|
||||
if (mylocale->provider == COLLPROVIDER_ICU)
|
||||
{
|
||||
Size bsize, rsize;
|
||||
char *buf;
|
||||
@ -1043,11 +1040,6 @@ hashbpchar(PG_FUNCTION_ARGS)
|
||||
|
||||
pfree(buf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* shouldn't happen */
|
||||
elog(ERROR, "unsupported collprovider: %c", mylocale->provider);
|
||||
}
|
||||
|
||||
/* Avoid leaking memory for toasted inputs */
|
||||
PG_FREE_IF_COPY(key, 0);
|
||||
@ -1083,9 +1075,6 @@ hashbpcharextended(PG_FUNCTION_ARGS)
|
||||
PG_GETARG_INT64(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_ICU
|
||||
if (mylocale->provider == COLLPROVIDER_ICU)
|
||||
{
|
||||
Size bsize, rsize;
|
||||
char *buf;
|
||||
@ -1107,11 +1096,6 @@ hashbpcharextended(PG_FUNCTION_ARGS)
|
||||
|
||||
pfree(buf);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* shouldn't happen */
|
||||
elog(ERROR, "unsupported collprovider: %c", mylocale->provider);
|
||||
}
|
||||
|
||||
PG_FREE_IF_COPY(key, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user