~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to contrib/intarray/_int_bool.c

Tags: upstream-8.4.0
ImportĀ upstreamĀ versionĀ 8.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $PostgreSQL: pgsql/contrib/intarray/_int_bool.c,v 1.15 2008/05/17 01:28:19 adunstan Exp $ 
 
2
 * $PostgreSQL: pgsql/contrib/intarray/_int_bool.c,v 1.16 2009/06/11 14:48:51 momjian Exp $
3
3
 */
4
4
#include "postgres.h"
5
5
 
54
54
        NODE       *str;
55
55
        /* number in str */
56
56
        int4            num;
57
 
}       WORKSTATE;
 
57
} WORKSTATE;
58
58
 
59
59
/*
60
60
 * get token from query string
61
61
 */
62
62
static int4
63
 
gettoken(WORKSTATE * state, int4 *val)
 
63
gettoken(WORKSTATE *state, int4 *val)
64
64
{
65
65
        char            nnn[16],
66
66
                           *curnnn;
143
143
 * push new one in polish notation reverse view
144
144
 */
145
145
static void
146
 
pushquery(WORKSTATE * state, int4 type, int4 val)
 
146
pushquery(WORKSTATE *state, int4 type, int4 val)
147
147
{
148
148
        NODE       *tmp = (NODE *) palloc(sizeof(NODE));
149
149
 
160
160
 * make polish notation of query
161
161
 */
162
162
static int4
163
 
makepol(WORKSTATE * state)
 
163
makepol(WORKSTATE *state)
164
164
{
165
165
        int4            val,
166
166
                                type;
239
239
 * is there value 'val' in array or not ?
240
240
 */
241
241
static bool
242
 
checkcondition_arr(void *checkval, ITEM * item)
 
242
checkcondition_arr(void *checkval, ITEM *item)
243
243
{
244
244
        int4       *StopLow = ((CHKVAL *) checkval)->arrb;
245
245
        int4       *StopHigh = ((CHKVAL *) checkval)->arre;
261
261
}
262
262
 
263
263
static bool
264
 
checkcondition_bit(void *checkval, ITEM * item)
 
264
checkcondition_bit(void *checkval, ITEM *item)
265
265
{
266
266
        return GETBIT(checkval, HASHVAL(item->val));
267
267
}
270
270
 * check for boolean condition
271
271
 */
272
272
static bool
273
 
execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM * item))
 
273
execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *item))
274
274
{
275
275
 
276
276
        if (curitem->type == VAL)
302
302
 * signconsistent & execconsistent called by *_consistent
303
303
 */
304
304
bool
305
 
signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot)
 
305
signconsistent(QUERYTYPE *query, BITVEC sign, bool calcnot)
306
306
{
307
307
        return execute(
308
308
                                   GETQUERY(query) + query->size - 1,
312
312
}
313
313
 
314
314
bool
315
 
execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot)
 
315
execconsistent(QUERYTYPE *query, ArrayType *array, bool calcnot)
316
316
{
317
317
        CHKVAL          chkval;
318
318
 
333
333
} GinChkVal;
334
334
 
335
335
static bool
336
 
checkcondition_gin(void *checkval, ITEM * item)
 
336
checkcondition_gin(void *checkval, ITEM *item)
337
337
{
338
338
        GinChkVal  *gcv = (GinChkVal *) checkval;
339
339
 
341
341
}
342
342
 
343
343
bool
344
 
ginconsistent(QUERYTYPE * query, bool *check)
 
344
ginconsistent(QUERYTYPE *query, bool *check)
345
345
{
346
346
        GinChkVal       gcv;
347
347
        ITEM       *items = GETQUERY(query);
408
408
}
409
409
 
410
410
static void
411
 
findoprnd(ITEM * ptr, int4 *pos)
 
411
findoprnd(ITEM *ptr, int4 *pos)
412
412
{
413
413
#ifdef BS_DEBUG
414
414
        elog(DEBUG3, (ptr[*pos].type == OPR) ?
618
618
}
619
619
 
620
620
static int4
621
 
countdroptree(ITEM * q, int4 pos)
 
621
countdroptree(ITEM *q, int4 pos)
622
622
{
623
623
        if (q[pos].type == VAL)
624
624
                return 1;
634
634
 * we can modify query tree for clearing
635
635
 */
636
636
int4
637
 
shorterquery(ITEM * q, int4 len)
 
637
shorterquery(ITEM *q, int4 len)
638
638
{
639
639
        int4            index,
640
640
                                posnot,