1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

pgindent run for 8.3.

This commit is contained in:
Bruce Momjian
2007-11-15 21:14:46 +00:00
parent 3adc760fb9
commit fdf5a5efb7
486 changed files with 10044 additions and 9664 deletions

View File

@ -16,23 +16,23 @@ Datum gin_trgm_consistent(PG_FUNCTION_ARGS);
Datum
gin_extract_trgm(PG_FUNCTION_ARGS)
{
text *val = (text *) PG_GETARG_TEXT_P(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
Datum *entries = NULL;
TRGM *trg;
text *val = (text *) PG_GETARG_TEXT_P(0);
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
Datum *entries = NULL;
TRGM *trg;
int4 trglen;
*nentries = 0;
trg = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ);
trglen = ARRNELEM(trg);
if (trglen > 0)
{
trgm *ptr;
int4 i = 0,
item;
trgm *ptr;
int4 i = 0,
item;
*nentries = (int32) trglen;
entries = (Datum *) palloc(sizeof(Datum) * trglen);
@ -41,7 +41,7 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
{
item = TRGMINT(ptr);
entries[i++] = Int32GetDatum(item);
ptr++;
}
}
@ -52,20 +52,20 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
Datum
gin_trgm_consistent(PG_FUNCTION_ARGS)
{
bool *check = (bool *) PG_GETARG_POINTER(0);
text *query = (text *) PG_GETARG_TEXT_P(2);
bool *check = (bool *) PG_GETARG_POINTER(0);
text *query = (text *) PG_GETARG_TEXT_P(2);
bool res = FALSE;
TRGM *trg;
TRGM *trg;
int4 i,
trglen,
ntrue = 0;
trg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ);
trglen = ARRNELEM(trg);
for (i = 0; i < trglen; i++)
if (check[i])
ntrue ++;
ntrue++;
#ifdef DIVUNION
res = (trglen == ntrue) ? true : ((((((float4) ntrue) / ((float4) (trglen - ntrue)))) >= trgm_limit) ? true : false);