@@ -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{
199203bool * check = (bool * )PG_GETARG_POINTER (0 );
200-
201204TSQuery query = PG_GETARG_TSQUERY (2 );
202-
203- Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
205+ Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
204206bool recheck ;
205207bool res = false;
206208
@@ -247,7 +249,6 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
247249int32 i ;
248250char * ptrt ;
249251WordEntryPos post ;
250-
251252post = 0 ;
252253int32 npos ;
253254int32 k = 0 ;
@@ -267,9 +268,7 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
267268/* caller wants an array of positions (phrase search) */
268269if (data )
269270{
270- const int32 itemsize = sizeof (* data -> pos );
271-
272- data -> pos = palloc (itemsize * npos );
271+ data -> pos = palloc (sizeof (* data -> pos )* npos );
273272data -> 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}
291290data -> npos = k ;
292- data -> pos = repalloc (data -> pos ,itemsize * k );
291+ data -> pos = repalloc (data -> pos ,sizeof ( * data -> pos ) * k );
293292return (k ?TS_YES :TS_NO );
294293}
295294
@@ -835,12 +834,10 @@ Datum
835834rum_tsquery_consistent (PG_FUNCTION_ARGS )
836835{
837836bool * check = (bool * )PG_GETARG_POINTER (0 );
838-
839837/* StrategyNumber strategy = PG_GETARG_UINT16(1); */
840838TSQuery query = PG_GETARG_TSQUERY (2 );
841-
842839/* int32nkeys = PG_GETARG_INT32(3); */
843- Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
840+ Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
844841bool * recheck = (bool * )PG_GETARG_POINTER (5 );
845842Datum * addInfo = (Datum * )PG_GETARG_POINTER (8 );
846843bool * addInfoIsNull = (bool * )PG_GETARG_POINTER (9 );
@@ -881,12 +878,10 @@ Datum
881878rum_tsquery_timestamp_consistent (PG_FUNCTION_ARGS )
882879{
883880bool * check = (bool * )PG_GETARG_POINTER (0 );
884-
885881/* StrategyNumber strategy = PG_GETARG_UINT16(1); */
886882TSQuery query = PG_GETARG_TSQUERY (2 );
887-
888883/* int32nkeys = PG_GETARG_INT32(3); */
889- Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
884+ Pointer * extra_data = (Pointer * )PG_GETARG_POINTER (4 );
890885bool * recheck = (bool * )PG_GETARG_POINTER (5 );
891886Datum * addInfo = (Datum * )PG_GETARG_POINTER (8 );
892887bool * addInfoIsNull = (bool * )PG_GETARG_POINTER (9 );