summaryrefslogtreecommitdiff
path: root/contrib/pg_trgm/trgm_gist.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_trgm/trgm_gist.c')
-rw-r--r--contrib/pg_trgm/trgm_gist.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c
index 2720d7fb70..7014394bb2 100644
--- a/contrib/pg_trgm/trgm_gist.c
+++ b/contrib/pg_trgm/trgm_gist.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gist.c,v 1.15 2008/07/11 11:56:48 teodor Exp $
+ * $PostgreSQL: pgsql/contrib/pg_trgm/trgm_gist.c,v 1.16 2009/06/11 14:48:51 momjian Exp $
*/
#include "trgm.h"
@@ -75,7 +75,7 @@ gtrgm_out(PG_FUNCTION_ARGS)
}
static void
-makesign(BITVECP sign, TRGM * a)
+makesign(BITVECP sign, TRGM *a)
{
int4 k,
len = ARRNELEM(a);
@@ -164,33 +164,34 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
text *query = PG_GETARG_TEXT_P(1);
+
/* StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); */
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
TRGM *key = (TRGM *) DatumGetPointer(entry->key);
TRGM *qtrg;
bool res = false;
- char *cache = (char*) fcinfo->flinfo->fn_extra;
+ char *cache = (char *) fcinfo->flinfo->fn_extra;
/* All cases served by this function are exact */
*recheck = false;
- if ( cache == NULL || VARSIZE(cache) != VARSIZE(query) || memcmp( cache, query, VARSIZE(query) ) !=0 )
+ if (cache == NULL || VARSIZE(cache) != VARSIZE(query) || memcmp(cache, query, VARSIZE(query)) != 0)
{
- qtrg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ);
+ qtrg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ);
if (cache)
pfree(cache);
fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt,
- MAXALIGN(VARSIZE(query)) + VARSIZE(qtrg) );
- cache = (char*) fcinfo->flinfo->fn_extra;
+ MAXALIGN(VARSIZE(query)) + VARSIZE(qtrg));
+ cache = (char *) fcinfo->flinfo->fn_extra;
- memcpy( cache, query, VARSIZE(query) );
- memcpy( cache + MAXALIGN(VARSIZE(query)), qtrg, VARSIZE(qtrg) );
+ memcpy(cache, query, VARSIZE(query));
+ memcpy(cache + MAXALIGN(VARSIZE(query)), qtrg, VARSIZE(qtrg));
}
- qtrg = (TRGM*)( cache + MAXALIGN(VARSIZE(query)) );
+ qtrg = (TRGM *) (cache + MAXALIGN(VARSIZE(query)));
if (GIST_LEAF(entry))
{ /* all leafs contains orig trgm */
@@ -228,7 +229,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
}
static int4
-unionkey(BITVECP sbase, TRGM * add)
+unionkey(BITVECP sbase, TRGM *add)
{
int4 i;
@@ -375,7 +376,7 @@ hemdistsign(BITVECP a, BITVECP b)
}
static int
-hemdist(TRGM * a, TRGM * b)
+hemdist(TRGM *a, TRGM *b)
{
if (ISALLTRUE(a))
{
@@ -425,7 +426,7 @@ typedef struct
} CACHESIGN;
static void
-fillcache(CACHESIGN *item, TRGM * key)
+fillcache(CACHESIGN *item, TRGM *key)
{
item->allistrue = false;
if (ISARRKEY(key))