1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Refactor from Heikki Linnakangas <heikki@enterprisedb.com>:

* Defined new struct WordEntryPosVector that holds a uint16 length and a
variable size array of WordEntries. This replaces the previous
convention of a variable size uint16 array, with the first element
implying the length. WordEntryPosVector has the same layout in memory,
but is more readable in source code. The POSDATAPTR and POSDATALEN
macros are still used, though it would now be more readable to access
the fields in WordEntryPosVector directly.

* Removed needfree field from DocRepresentation. It was always set to false.

* Miscellaneous other commenting and refactoring
This commit is contained in:
Teodor Sigaev
2007-09-11 08:46:29 +00:00
parent ef4d38c86c
commit 57cafe7982
5 changed files with 109 additions and 58 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.3 2007/09/07 16:03:40 teodor Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/tsginidx.c,v 1.4 2007/09/11 08:46:29 teodor Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,13 +25,12 @@ gin_extract_tsvector(PG_FUNCTION_ARGS)
int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
Datum *entries = NULL;
*nentries = 0;
*nentries = vector->size;
if (vector->size > 0)
{
int i;
WordEntry *we = ARRPTR(vector);
*nentries = (uint32) vector->size;
entries = (Datum *) palloc(sizeof(Datum) * vector->size);
for (i = 0; i < vector->size; i++)
@@ -134,11 +133,19 @@ gin_ts_consistent(PG_FUNCTION_ARGS)
if (query->size > 0)
{
int4 i,
int i,
j = 0;
QueryItem *item;
GinChkVal gcv;
/*
* check-parameter array has one entry for each value (operand) in the
* query. We expand that array into mapped_check, so that there's one
* entry in mapped_check for every node in the query, including
* operators, to allow quick lookups in checkcondition_gin. Only the
* entries corresponding operands are actually used.
*/
gcv.frst = item = GETQUERY(query);
gcv.mapped_check = (bool *) palloc(sizeof(bool) * query->size);