From e5be89981fc70648eedb325781cf2fbd4da05ba8 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 7 Sep 2007 15:09:56 +0000 Subject: Refactoring by Heikki Linnakangas with small editorization by me - Brake the QueryItem struct into QueryOperator and QueryOperand. Type was really the only common field between them. QueryItem still exists, and is used in the TSQuery struct as before, but it's now a union of the two. Many other changes fell from that, like separation of pushval_asis function into pushValue, pushOperator and pushStop. - Moved some structs that were for internal use only from header files to the right .c-files. - Moved tsvector parser to a new tsvector_parser.c file. Parser code was about half of the size of tsvector.c, it's also used from tsquery.c, and it has some data structures of its own, so it seems better to separate it. Cleaned up the API so that TSVectorParserState is not accessed from outside tsvector_parser.c. - Separated enumerations (#defines, really) used for QueryItem.type field and as return codes from gettoken_query. It was just accidental code sharing. - Removed ParseQueryNode struct used internally by makepol and friends. push*-functions now construct QueryItems directly. - Changed int4 variables to just ints for variables like "i" or "array size", where the storage-size was not significant. --- src/backend/utils/adt/tsgistidx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backend/utils/adt/tsgistidx.c') diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 6c262521ef4..4fc51378b4b 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/tsgistidx.c,v 1.2 2007/08/21 06:34:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/tsgistidx.c,v 1.3 2007/09/07 15:09:56 teodor Exp $ * *------------------------------------------------------------------------- */ @@ -293,7 +293,7 @@ typedef struct * is there value 'val' in array or not ? */ static bool -checkcondition_arr(void *checkval, QueryItem * val) +checkcondition_arr(void *checkval, QueryOperand * val) { int4 *StopLow = ((CHKVAL *) checkval)->arrb; int4 *StopHigh = ((CHKVAL *) checkval)->arre; @@ -304,9 +304,9 @@ checkcondition_arr(void *checkval, QueryItem * val) while (StopLow < StopHigh) { StopMiddle = StopLow + (StopHigh - StopLow) / 2; - if (*StopMiddle == val->val) + if (*StopMiddle == val->valcrc) return (true); - else if (*StopMiddle < val->val) + else if (*StopMiddle < val->valcrc) StopLow = StopMiddle + 1; else StopHigh = StopMiddle; @@ -316,9 +316,9 @@ checkcondition_arr(void *checkval, QueryItem * val) } static bool -checkcondition_bit(void *checkval, QueryItem * val) +checkcondition_bit(void *checkval, QueryOperand * val) { - return GETBIT(checkval, HASHVAL(val->val)); + return GETBIT(checkval, HASHVAL(val->valcrc)); } Datum -- cgit v1.2.3