@@ -171,7 +171,11 @@ static WordEntryPosVector POSNULL = {
171171#define RANK_NORM_RDIVRPLUS1 0x20
172172#define DEF_NORM_METHOD RANK_NO_NORM
173173
174- #define TS_EXEC_IN_NEG 0x04
174+ /*
175+ * Should not conflict with defines
176+ * TS_EXEC_EMPTY/TS_EXEC_CALC_NOT/TS_EXEC_PHRASE_NO_POS
177+ */
178+ #define TS_EXEC_IN_NEG 0x04
175179
176180#define QR_GET_OPERAND (q , v ) \
177181 (&((q)->operandData[ ((QueryItem*)(v)) - GETQUERY((q)->query) ]))
@@ -197,10 +201,8 @@ Datum
197201rum_tsquery_pre_consistent (PG_FUNCTION_ARGS )
198202{
199203 bool * check = (bool * ) PG_GETARG_POINTER (0 );
200-
201204 TSQuery query = PG_GETARG_TSQUERY (2 );
202-
203- Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
205+ Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
204206 bool recheck ;
205207 bool res = false;
206208
@@ -247,7 +249,6 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
247249 int32 i ;
248250 char * ptrt ;
249251 WordEntryPos post ;
250-
251252 post = 0 ;
252253 int32 npos ;
253254 int32 k = 0 ;
@@ -267,9 +268,7 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
267268 /* caller wants an array of positions (phrase search) */
268269 if (data )
269270 {
270- const int32 itemsize = sizeof (* data -> pos );
271-
272- data -> pos = palloc (itemsize * npos );
271+ data -> pos = palloc (sizeof (* data -> pos ) * npos );
273272 data -> allocated = true;
274273
275274 /* Fill positions that has right weight to return to a caller */
@@ -289,7 +288,7 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
289288 }
290289 }
291290 data -> npos = k ;
292- data -> pos = repalloc (data -> pos , itemsize * k );
291+ data -> pos = repalloc (data -> pos , sizeof ( * data -> pos ) * k );
293292 return (k ? TS_YES : TS_NO );
294293 }
295294
@@ -835,12 +834,10 @@ Datum
835834rum_tsquery_consistent (PG_FUNCTION_ARGS )
836835{
837836 bool * check = (bool * ) PG_GETARG_POINTER (0 );
838-
839837 /* StrategyNumber strategy = PG_GETARG_UINT16(1); */
840838 TSQuery query = PG_GETARG_TSQUERY (2 );
841-
842839 /* int32 nkeys = PG_GETARG_INT32(3); */
843- Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
840+ Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
844841 bool * recheck = (bool * ) PG_GETARG_POINTER (5 );
845842 Datum * addInfo = (Datum * ) PG_GETARG_POINTER (8 );
846843 bool * addInfoIsNull = (bool * ) PG_GETARG_POINTER (9 );
@@ -881,12 +878,10 @@ Datum
881878rum_tsquery_timestamp_consistent (PG_FUNCTION_ARGS )
882879{
883880 bool * check = (bool * ) PG_GETARG_POINTER (0 );
884-
885881 /* StrategyNumber strategy = PG_GETARG_UINT16(1); */
886882 TSQuery query = PG_GETARG_TSQUERY (2 );
887-
888883 /* int32 nkeys = PG_GETARG_INT32(3); */
889- Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
884+ Pointer * extra_data = (Pointer * ) PG_GETARG_POINTER (4 );
890885 bool * recheck = (bool * ) PG_GETARG_POINTER (5 );
891886 Datum * addInfo = (Datum * ) PG_GETARG_POINTER (8 );
892887 bool * addInfoIsNull = (bool * ) PG_GETARG_POINTER (9 );
0 commit comments