Skip to content

Commit fe6c3fd

Browse files
committed
reformatting completed, all tests pass
1 parent fbb1ae9 commit fe6c3fd

File tree

5 files changed

+44
-32
lines changed

5 files changed

+44
-32
lines changed

src/backend/utils/adt/tsvector_op.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -590,29 +590,30 @@ tsCompareString(char *a, int lena, char *b, int lenb, bool prefix)
590590
* check weight info or/and fill data by needed positions
591591
*/
592592
static bool
593-
checkclass_str(CHKVAL *chkval, WordEntry *entry, QueryOperand *val, ExecPhraseData *data)
593+
checkclass_str(CHKVAL *chkval, WordEntry *entry, QueryOperand *val,
594+
ExecPhraseData *data)
594595
{
595596
bool res = false;
596597

597-
if (entry->haspos && (val->weight || data) )
598+
if (entry->haspos && (val->weight || data))
598599
{
599600
WordEntryPosVector *posvec;
600601

601602
posvec = (WordEntryPosVector *)
602603
(chkval->values + SHORTALIGN(entry->pos + entry->len));
603604

604-
if ( val->weight && data )
605+
if (val->weight && data)
605606
{
606-
WordEntryPos *ptr = posvec->pos;
607-
WordEntryPos *dptr;
607+
WordEntryPos *ptr = posvec->pos;
608+
WordEntryPos *dptr;
608609

609610
/*
610611
* Filter position information by weights
611612
*/
612613
dptr = data->pos = palloc(sizeof(WordEntryPos) * posvec->npos);
613614
data->allocated = true;
614615

615-
while( ptr - posvec->pos < posvec->npos )
616+
while (ptr - posvec->pos < posvec->npos)
616617
{
617618
if (val->weight & (1 << WEP_GETWEIGHT(*ptr)))
618619
{
@@ -625,14 +626,14 @@ checkclass_str(CHKVAL *chkval, WordEntry *entry, QueryOperand *val, ExecPhraseDa
625626

626627
data->npos = dptr - data->pos;
627628

628-
if ( data->npos > 0 )
629+
if (data->npos > 0)
629630
res = true;
630631
}
631-
else if ( val->weight )
632+
else if (val->weight)
632633
{
633-
WordEntryPos *ptr = posvec->pos;
634+
WordEntryPos *ptr = posvec->pos;
634635

635-
while( ptr - posvec->pos < posvec->npos )
636+
while (ptr - posvec->pos < posvec->npos)
636637
{
637638
if (val->weight & (1 << WEP_GETWEIGHT(*ptr)))
638639
{
@@ -739,7 +740,7 @@ checkcondition_str(void *checkval, QueryOperand *val, ExecPhraseData *data)
739740

740741
while ((res == false || data) && StopMiddle < chkval->arre &&
741742
tsCompareString(chkval->operand + val->distance, val->length,
742-
chkval->values + StopMiddle->pos, StopMiddle->len,
743+
chkval->values + StopMiddle->pos, StopMiddle->len,
743744
true) == 0)
744745
{
745746
if (data)
@@ -766,7 +767,7 @@ checkcondition_str(void *checkval, QueryOperand *val, ExecPhraseData *data)
766767
}
767768

768769
memcpy(allpos+npos, data->pos, sizeof(WordEntryPos) * data->npos);
769-
npos+=data->npos;
770+
npos += data->npos;
770771
}
771772
}
772773
else
@@ -817,17 +818,19 @@ TS_phrase_execute(QueryItem *curitem, void *checkval, bool calcnot, ExecPhraseDa
817818
if (data)
818819
data->npos = 0;
819820

820-
if (TS_phrase_execute(curitem + curitem->qoperator.left, checkval, calcnot, &Ldata, chkcond) == false)
821+
if (TS_phrase_execute(curitem + curitem->qoperator.left,
822+
checkval, calcnot, &Ldata, chkcond) == false)
821823
return false;
822824

823-
if (TS_phrase_execute(curitem + 1, checkval, calcnot, &Rdata, chkcond) == false)
825+
if (TS_phrase_execute(curitem + 1,
826+
checkval, calcnot, &Rdata, chkcond) == false)
824827
return false;
825828

826829
/*
827830
* if at least one of operand has not a position information then
828831
* fallback to AND operation.
829832
*/
830-
if ( Ldata.npos == 0 || Rdata.npos == 0 )
833+
if (Ldata.npos == 0 || Rdata.npos == 0)
831834
return true;
832835

833836
/*
@@ -841,7 +844,8 @@ TS_phrase_execute(QueryItem *curitem, void *checkval, bool calcnot, ExecPhraseDa
841844
* OP_PHRASE is a modificated OP_AND, so number of resulting
842845
* positions could not be greater than any of operands
843846
*/
844-
data->pos = palloc(sizeof(WordEntryPos) * Min(Ldata.npos, Rdata.npos));
847+
data->pos = palloc(sizeof(WordEntryPos) *
848+
Min(Ldata.npos, Rdata.npos));
845849
else
846850
data->pos = Rdata.pos;
847851

@@ -858,9 +862,9 @@ TS_phrase_execute(QueryItem *curitem, void *checkval, bool calcnot, ExecPhraseDa
858862
* ExecPhraseData->data could point to the tsvector's WordEntryPosVector
859863
*/
860864

861-
while(Rpos - Rdata.pos < Rdata.npos)
865+
while (Rpos - Rdata.pos < Rdata.npos)
862866
{
863-
while(Lpos - Ldata.pos < Ldata.npos)
867+
while (Lpos - Ldata.pos < Ldata.npos)
864868
{
865869
if (WEP_GETPOS(*Lpos) <= WEP_GETPOS(*Rpos))
866870
{
@@ -927,7 +931,8 @@ TS_phrase_execute(QueryItem *curitem, void *checkval, bool calcnot, ExecPhraseDa
927931
*/
928932
bool
929933
TS_execute(QueryItem *curitem, void *checkval, bool calcnot,
930-
bool (*chkcond) (void *checkval, QueryOperand *val, ExecPhraseData *data))
934+
bool (*chkcond) (void *checkval, QueryOperand *val,
935+
ExecPhraseData *data))
931936
{
932937
/* since this function recurses, it could be driven to stack overflow */
933938
check_stack_depth();

src/backend/utils/adt/tsvector_parser.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ do { \
8989
} \
9090
} while (0)
9191

92-
#define ISOPERATOR(x) ( pg_mblen(x)==1 && ( *(x)=='!' || *(x)=='&' || *(x)=='|' || *(x)=='?' || *(x)=='(' || *(x)==')' ) )
92+
#define ISOPERATOR(x) \
93+
( pg_mblen(x) == 1 && ( *(x) == '!' || \
94+
*(x) == '&' || \
95+
*(x) == '|' || \
96+
*(x) == '?' || \
97+
*(x) == '(' || \
98+
*(x) == ')' \
99+
) )
93100

94101
/* Fills gettoken_tsvector's output parameters, and returns true */
95102
#define RETURN_TOKEN \

src/include/catalog/pg_operator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ DESCR("AND-concatenate");
16721672
DATA(insert OID = 3681 ( "||" PGNSP PGUID b f f 3615 3615 3615 0 0 tsquery_or - - ));
16731673
DESCR("OR-concatenate");
16741674
/* ?? operation calls tsquery_phrase, but function is polymorphic. So, point OID of tsquery_phrase */
1675-
DATA(insert OID = 5005 ( "??" PGNSP PGUID b f f 3615 3615 3615 0 0 5003 - - ));
1675+
DATA(insert OID = 5005 ( "??" PGNSP PGUID b f f 3615 3615 3615 0 0 5003 - - ));
16761676
DESCR("phrase-concatenate");
16771677
DATA(insert OID = 3682 ( "!!" PGNSP PGUID l f f 0 3615 3615 0 0 tsquery_not - - ));
16781678
DESCR("NOT tsquery");

src/include/catalog/pg_proc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,11 +4616,11 @@ DESCR("less-equal-greater");
46164616

46174617
DATA(insert OID = 3669 ( tsquery_and PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_and _null_ _null_ _null_ ));
46184618
DATA(insert OID = 3670 ( tsquery_or PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_or _null_ _null_ _null_ ));
4619-
DATA(insert OID = 5003 ( tsquery_phrase PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_phrase _null_ _null_ _null_ ));
4620-
DATA(insert OID = 5004 ( tsquery_phrase PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 3615 "3615 3615 25" _null_ _null_ _null_ _null_ _null_ tsquery_phrase_distance _null_ _null_ _null_ ));
4619+
DATA(insert OID = 5003 ( tsquery_phrase PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsquery_phrase _null_ _null_ _null_ ));
4620+
DATA(insert OID = 5004 ( tsquery_phrase PGNSP PGUID 12 1 0 0 0 f f f f t f i 3 0 3615 "3615 3615 25" _null_ _null_ _null_ _null_ _null_ tsquery_phrase_distance _null_ _null_ _null_ ));
46214621
DESCR("phrase-concatenate with distance");
46224622
DATA(insert OID = 3671 ( tsquery_not PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 3615 "3615" _null_ _null_ _null_ _null_ _null_ tsquery_not _null_ _null_ _null_ ));
4623-
DATA(insert OID = 5002 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 18" _null_ _null_ _null_ _null_ _null_ tsquery_setweight _null_ _null_ _null_ ));
4623+
DATA(insert OID = 5002 ( setweight PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 3615 "3615 18" _null_ _null_ _null_ _null_ _null_ tsquery_setweight _null_ _null_ _null_ ));
46244624
DESCR("add weight class");
46254625

46264626
DATA(insert OID = 3691 ( tsq_mcontains PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ _null_ tsq_mcontains _null_ _null_ _null_ ));

src/include/tsearch/ts_public.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ typedef struct
3434
*/
3535
typedef struct
3636
{
37-
uint32 selected:1,
38-
in:1,
39-
replace:1,
40-
repeated:1,
41-
skip:1,
42-
unused:3,
43-
type:8,
44-
len:16;
37+
uint32 selected: 1,
38+
in: 1,
39+
replace: 1,
40+
repeated: 1,
41+
skip: 1,
42+
unused: 3,
43+
type: 8,
44+
len: 16;
4545
WordEntryPos pos;
4646
char *word;
4747
QueryOperand *item;

0 commit comments

Comments
 (0)