static float8
gbt_int2_dist(const void *a, const void *b)
{
- return GET_FLOAT_DISTANCE(int2, a, b);
+ return GET_FLOAT_DISTANCE(int16, a, b);
}
Datum
int2_dist(PG_FUNCTION_ARGS)
{
- int2 a = PG_GETARG_INT16(0);
- int2 b = PG_GETARG_INT16(1);
- int2 r;
- int2 ra;
+ int16 a = PG_GETARG_INT16(0);
+ int16 b = PG_GETARG_INT16(1);
+ int16 r;
+ int16 ra;
r = a - b;
ra = Abs(r);
static float8
gbt_int4_dist(const void *a, const void *b)
{
- return GET_FLOAT_DISTANCE(int4, a, b);
+ return GET_FLOAT_DISTANCE(int32, a, b);
}
Datum
int4_dist(PG_FUNCTION_ARGS)
{
- int4 a = PG_GETARG_INT32(0);
- int4 b = PG_GETARG_INT32(1);
- int4 r;
- int4 ra;
+ int32 a = PG_GETARG_INT32(0);
+ int32 b = PG_GETARG_INT32(1);
+ int32 r;
+ int32 ra;
r = a - b;
ra = Abs(r);
(errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
errmsg("cannot work with arrays containing NULLs")));
- dx = (int4 *) ARR_DATA_PTR(idx);
+ dx = (int32 *) ARR_DATA_PTR(idx);
dim = ARRNELEMS(idx);
size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim;
{
NDBOX *a = PG_GETARG_NDBOX(0);
double r = PG_GETARG_FLOAT8(1);
- int4 n = PG_GETARG_INT32(2);
+ int32 n = PG_GETARG_INT32(2);
NDBOX *result;
int dim = 0;
int size;
bool needfree; /* need to pfree the value? */
} Pairs;
-extern int hstoreUniquePairs(Pairs *a, int4 l, int4 *buflen);
-extern HStore *hstorePairs(Pairs *pairs, int4 pcount, int4 buflen);
+extern int hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen);
+extern HStore *hstorePairs(Pairs *pairs, int32 pcount, int32 buflen);
extern size_t hstoreCheckKeyLen(size_t len);
extern size_t hstoreCheckValLen(size_t len);
typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 flag;
+ int32 flag;
char data[1];
} GISTTYPE;
#define ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE )
-#define GTHDRSIZE (VARHDRSZ + sizeof(int4))
+#define GTHDRSIZE (VARHDRSZ + sizeof(int32))
#define CALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
#define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )
}
else if (!ISALLTRUE(DatumGetPointer(entry->key)))
{
- int4 i;
+ int32 i;
GISTTYPE *res;
BITVECP sign = GETSIGN(DatumGetPointer(entry->key));
*result = false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = GETSIGN(a),
sb = GETSIGN(b);
PG_RETURN_POINTER(result);
}
-static int4
+static int32
sizebitvec(BITVECP sign)
{
- int4 size = 0,
+ int32 size = 0,
i;
LOOPBYTE
return hemdistsign(GETSIGN(a), GETSIGN(b));
}
-static int4
+static int32
unionkey(BITVECP sbase, GISTTYPE *add)
{
- int4 i;
+ int32 i;
BITVECP sadd = GETSIGN(add);
if (ISALLTRUE(add))
ghstore_union(PG_FUNCTION_ARGS)
{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
- int4 len = entryvec->n;
+ int32 len = entryvec->n;
int *size = (int *) PG_GETARG_POINTER(1);
BITVEC base;
- int4 i;
- int4 flag = 0;
+ int32 i;
+ int32 flag = 0;
GISTTYPE *result;
MemSet((void *) base, 0, sizeof(BITVEC));
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
*datum_r;
BITVECP union_l,
union_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
do { \
if ( state->cur - state->word + 1 >= state->wordlen ) \
{ \
- int4 clen = state->cur - state->word; \
+ int32 clen = state->cur - state->word; \
state->wordlen *= 2; \
state->word = (char*)repalloc( (void*)state->word, state->wordlen ); \
state->cur = state->word + clen; \
}
else if (*(state->ptr) == '=' && !ignoreeq)
{
- elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int4) (state->ptr - state->begin));
+ elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int32) (state->ptr - state->begin));
}
else if (*(state->ptr) == '\\')
{
}
else if (!isspace((unsigned char) *(state->ptr)))
{
- elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int4) (state->ptr - state->begin));
+ elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int32) (state->ptr - state->begin));
}
}
else if (st == WGT)
}
else
{
- elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int4) (state->ptr - state->begin));
+ elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int32) (state->ptr - state->begin));
}
}
else if (st == WVAL)
}
else if (!isspace((unsigned char) *(state->ptr)))
{
- elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int4) (state->ptr - state->begin));
+ elog(ERROR, "Syntax error near '%c' at position %d", *(state->ptr), (int32) (state->ptr - state->begin));
}
}
else
* and (b) who knows whether they might be needed by some caller.
*/
int
-hstoreUniquePairs(Pairs *a, int4 l, int4 *buflen)
+hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen)
{
Pairs *ptr,
*res;
HStore *
-hstorePairs(Pairs *pairs, int4 pcount, int4 buflen)
+hstorePairs(Pairs *pairs, int32 pcount, int32 buflen)
{
HStore *out;
HEntry *entry;
char *ptr;
char *buf;
- int4 len;
- int4 i;
+ int32 len;
+ int32 i;
len = CALCDATASIZE(pcount, buflen);
out = palloc(len);
hstore_in(PG_FUNCTION_ARGS)
{
HSParser state;
- int4 buflen;
+ int32 buflen;
HStore *out;
state.begin = PG_GETARG_CSTRING(0);
Datum
hstore_recv(PG_FUNCTION_ARGS)
{
- int4 buflen;
+ int32 buflen;
HStore *out;
Pairs *pairs;
- int4 i;
- int4 pcount;
+ int32 i;
+ int32 pcount;
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
pcount = pq_getmsgint(buf, 4);
Datum
hstore_from_arrays(PG_FUNCTION_ARGS)
{
- int4 buflen;
+ int32 buflen;
HStore *out;
Pairs *pairs;
Datum *key_datums;
ArrayType *in_array = PG_GETARG_ARRAYTYPE_P(0);
int ndims = ARR_NDIM(in_array);
int count;
- int4 buflen;
+ int32 buflen;
HStore *out;
Pairs *pairs;
Datum *in_datums;
hstore_from_record(PG_FUNCTION_ARGS)
{
HeapTupleHeader rec;
- int4 buflen;
+ int32 buflen;
HStore *out;
Pairs *pairs;
Oid tupType;
#define MAXNUMRANGE 100
/* useful macros for accessing int4 arrays */
-#define ARRPTR(x) ( (int4 *) ARR_DATA_PTR(x) )
+#define ARRPTR(x) ( (int32 *) ARR_DATA_PTR(x) )
#define ARRNELEMS(x) ArrayGetNItems(ARR_NDIM(x), ARR_DIMS(x))
/* reject arrays we can't handle; to wit, those containing nulls */
typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 flag;
+ int32 flag;
char data[1];
} GISTTYPE;
#define ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE )
-#define GTHDRSIZE (VARHDRSZ + sizeof(int4))
+#define GTHDRSIZE (VARHDRSZ + sizeof(int32))
#define CALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
#define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )
/*
* useful functions
*/
-bool isort(int4 *a, int len);
+bool isort(int32 *a, int len);
ArrayType *new_intArrayType(int num);
ArrayType *copy_intArrayType(ArrayType *a);
ArrayType *resize_intArrayType(ArrayType *a, int num);
*/
typedef struct ITEM
{
- int2 type;
- int2 left;
- int4 val;
+ int16 type;
+ int16 left;
+ int32 val;
} ITEM;
typedef struct QUERYTYPE
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 size; /* number of ITEMs */
+ int32 size; /* number of ITEMs */
ITEM items[1]; /* variable length array */
} QUERYTYPE;
do { \
int _nelems_ = ARRNELEMS(a); \
if (_nelems_ > 1) \
- qsort((void*) ARRPTR(a), _nelems_, sizeof(int4), \
+ qsort((void*) ARRPTR(a), _nelems_, sizeof(int32), \
(direction) ? compASC : compDESC ); \
} while(0)
*/
typedef struct NODE
{
- int4 type;
- int4 val;
+ int32 type;
+ int32 val;
struct NODE *next;
} NODE;
typedef struct
{
char *buf;
- int4 state;
- int4 count;
+ int32 state;
+ int32 count;
/* reverse polish notation in list (for temporary usage) */
NODE *str;
/* number in str */
- int4 num;
+ int32 num;
} WORKSTATE;
/*
* get token from query string
*/
-static int4
-gettoken(WORKSTATE *state, int4 *val)
+static int32
+gettoken(WORKSTATE *state, int32 *val)
{
char nnn[16];
int innn;
else if (*(state->buf) == '!')
{
(state->buf)++;
- *val = (int4) '!';
+ *val = (int32) '!';
return OPR;
}
else if (*(state->buf) == '(')
nnn[innn] = '\0';
errno = 0;
lval = strtol(nnn, NULL, 0);
- *val = (int4) lval;
+ *val = (int32) lval;
if (errno != 0 || (long) *val != lval)
return ERR;
state->state = WAITOPERATOR;
if (*(state->buf) == '&' || *(state->buf) == '|')
{
state->state = WAITOPERAND;
- *val = (int4) *(state->buf);
+ *val = (int32) *(state->buf);
(state->buf)++;
return OPR;
}
* push new one in polish notation reverse view
*/
static void
-pushquery(WORKSTATE *state, int4 type, int4 val)
+pushquery(WORKSTATE *state, int32 type, int32 val)
{
NODE *tmp = (NODE *) palloc(sizeof(NODE));
/*
* make polish notation of query
*/
-static int4
+static int32
makepol(WORKSTATE *state)
{
- int4 val,
+ int32 val,
type;
- int4 stack[STACKDEPTH];
- int4 lenstack = 0;
+ int32 stack[STACKDEPTH];
+ int32 lenstack = 0;
/* since this function recurses, it could be driven to stack overflow */
check_stack_depth();
{
case VAL:
pushquery(state, type, val);
- while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
- stack[lenstack - 1] == (int4) '!'))
+ while (lenstack && (stack[lenstack - 1] == (int32) '&' ||
+ stack[lenstack - 1] == (int32) '!'))
{
lenstack--;
pushquery(state, OPR, stack[lenstack]);
}
break;
case OPR:
- if (lenstack && val == (int4) '|')
+ if (lenstack && val == (int32) '|')
pushquery(state, OPR, val);
else
{
case OPEN:
if (makepol(state) == ERR)
return ERR;
- while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
- stack[lenstack - 1] == (int4) '!'))
+ while (lenstack && (stack[lenstack - 1] == (int32) '&' ||
+ stack[lenstack - 1] == (int32) '!'))
{
lenstack--;
pushquery(state, OPR, stack[lenstack]);
typedef struct
{
- int4 *arrb;
- int4 *arre;
+ int32 *arrb;
+ int32 *arre;
} CHKVAL;
/*
static bool
checkcondition_arr(void *checkval, ITEM *item)
{
- int4 *StopLow = ((CHKVAL *) checkval)->arrb;
- int4 *StopHigh = ((CHKVAL *) checkval)->arre;
- int4 *StopMiddle;
+ int32 *StopLow = ((CHKVAL *) checkval)->arrb;
+ int32 *StopHigh = ((CHKVAL *) checkval)->arre;
+ int32 *StopMiddle;
/* Loop invariant: StopLow <= val < StopHigh */
if (curitem->type == VAL)
return (*chkcond) (checkval, curitem);
- else if (curitem->val == (int4) '!')
+ else if (curitem->val == (int32) '!')
{
return (calcnot) ?
((execute(curitem - 1, checkval, calcnot, chkcond)) ? false : true)
: true;
}
- else if (curitem->val == (int4) '&')
+ else if (curitem->val == (int32) '&')
{
if (execute(curitem + curitem->left, checkval, calcnot, chkcond))
return execute(curitem - 1, checkval, calcnot, chkcond);
if (curitem->type == VAL)
return true;
- else if (curitem->val == (int4) '!')
+ else if (curitem->val == (int32) '!')
{
/*
* Assume anything under a NOT is non-required. For some cases with
*/
return false;
}
- else if (curitem->val == (int4) '&')
+ else if (curitem->val == (int32) '&')
{
/* If either side has a required value, we're good */
if (contains_required_value(curitem + curitem->left))
}
static void
-findoprnd(ITEM *ptr, int4 *pos)
+findoprnd(ITEM *ptr, int32 *pos)
{
#ifdef BS_DEBUG
elog(DEBUG3, (ptr[*pos].type == OPR) ?
ptr[*pos].left = 0;
(*pos)--;
}
- else if (ptr[*pos].val == (int4) '!')
+ else if (ptr[*pos].val == (int32) '!')
{
ptr[*pos].left = -1;
(*pos)--;
else
{
ITEM *curitem = &ptr[*pos];
- int4 tmp = *pos;
+ int32 tmp = *pos;
(*pos)--;
findoprnd(ptr, pos);
{
char *buf = (char *) PG_GETARG_POINTER(0);
WORKSTATE state;
- int4 i;
+ int32 i;
QUERYTYPE *query;
- int4 commonlen;
+ int32 commonlen;
ITEM *ptr;
NODE *tmp;
- int4 pos = 0;
+ int32 pos = 0;
#ifdef BS_DEBUG
StringInfoData pbuf;
ITEM *curpol;
char *buf;
char *cur;
- int4 buflen;
+ int32 buflen;
} INFIX;
#define RESIZEBUF(inf,addsize) while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) { \
- int4 len = inf->cur - inf->buf; \
+ int32 len = inf->cur - inf->buf; \
inf->buflen *= 2; \
inf->buf = (char*) repalloc( (void*)inf->buf, inf->buflen ); \
inf->cur = inf->buf + len; \
in->cur = strchr(in->cur, '\0');
in->curpol--;
}
- else if (in->curpol->val == (int4) '!')
+ else if (in->curpol->val == (int32) '!')
{
bool isopr = false;
}
else
{
- int4 op = in->curpol->val;
+ int32 op = in->curpol->val;
INFIX nrm;
in->curpol--;
- if (op == (int4) '|' && !first)
+ if (op == (int32) '|' && !first)
{
RESIZEBUF(in, 2);
sprintf(in->cur, "( ");
in->cur = strchr(in->cur, '\0');
pfree(nrm.buf);
- if (op == (int4) '|' && !first)
+ if (op == (int32) '|' && !first)
{
RESIZEBUF(in, 2);
sprintf(in->cur, " )");
*nentries = ARRNELEMS(query);
if (*nentries > 0)
{
- int4 *arr;
+ int32 *arr;
int32 i;
res = (Datum *) palloc(sizeof(Datum) * (*nentries));
{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int *size = (int *) PG_GETARG_POINTER(1);
- int4 i,
+ int32 i,
*ptr;
ArrayType *res;
int totlen = 0;
int nel;
nel = ARRNELEMS(ent);
- memcpy(ptr, ARRPTR(ent), nel * sizeof(int4));
+ memcpy(ptr, ARRPTR(ent), nel * sizeof(int32));
ptr += nel;
}
ArrayType *a = PG_GETARG_ARRAYTYPE_P(0);
ArrayType *b = PG_GETARG_ARRAYTYPE_P(1);
bool *result = (bool *) PG_GETARG_POINTER(2);
- int4 n = ARRNELEMS(a);
- int4 *da,
+ int32 n = ARRNELEMS(a);
+ int32 *da,
*db;
CHECKARRVALID(a);
/* Sort the given data (len >= 2). Return true if any duplicates found */
bool
-isort(int4 *a, int len)
+isort(int32 *a, int len)
{
- int4 cur,
+ int32 cur,
prev;
- int4 *pcur,
+ int32 *pcur,
*pprev,
*end;
bool r = FALSE;
int n = ARRNELEMS(a);
r = new_intArrayType(n);
- memcpy(ARRPTR(r), ARRPTR(a), n * sizeof(int4));
+ memcpy(ARRPTR(r), ARRPTR(a), n * sizeof(int32));
return r;
}
int
compASC(const void *a, const void *b)
{
- if (*(const int4 *) a == *(const int4 *) b)
+ if (*(const int32 *) a == *(const int32 *) b)
return 0;
- return (*(const int4 *) a > *(const int4 *) b) ? 1 : -1;
+ return (*(const int32 *) a > *(const int32 *) b) ? 1 : -1;
}
int
compDESC(const void *a, const void *b)
{
- if (*(const int4 *) a == *(const int4 *) b)
+ if (*(const int32 *) a == *(const int32 *) b)
return 0;
- return (*(const int4 *) a < *(const int4 *) b) ? 1 : -1;
+ return (*(const int32 *) a < *(const int32 *) b) ? 1 : -1;
}
_intbig_overlap(GISTTYPE *a, ArrayType *b)
{
int num = ARRNELEMS(b);
- int4 *ptr = ARRPTR(b);
+ int32 *ptr = ARRPTR(b);
CHECKARRVALID(b);
_intbig_contains(GISTTYPE *a, ArrayType *b)
{
int num = ARRNELEMS(b);
- int4 *ptr = ARRPTR(b);
+ int32 *ptr = ARRPTR(b);
CHECKARRVALID(b);
*result = false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = GETSIGN(a),
sb = GETSIGN(b);
{
GISTENTRY *retval;
ArrayType *in = DatumGetArrayTypeP(entry->key);
- int4 *ptr;
+ int32 *ptr;
int num;
GISTTYPE *res = (GISTTYPE *) palloc0(CALCGTSIZE(0));
}
-static int4
+static int32
sizebitvec(BITVECP sign)
{
- int4 size = 0,
+ int32 size = 0,
i;
LOOPBYTE
PG_RETURN_DATUM(PG_GETARG_DATUM(0));
}
-static int4
+static int32
unionkey(BITVECP sbase, GISTTYPE *add)
{
- int4 i;
+ int32 i;
BITVECP sadd = GETSIGN(add);
if (ISALLTRUE(add))
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int *size = (int *) PG_GETARG_POINTER(1);
BITVEC base;
- int4 i,
+ int32 i,
len;
- int4 flag = 0;
+ int32 flag = 0;
GISTTYPE *result;
MemSet((void *) base, 0, sizeof(BITVEC));
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
*datum_r;
BITVECP union_l,
union_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
{
int i,
num = ARRNELEMS(query);
- int4 *ptr = ARRPTR(query);
+ int32 *ptr = ARRPTR(query);
BITVEC qp;
BITVECP dq,
de;
{
int i,
num = ARRNELEMS(query);
- int4 *ptr = ARRPTR(query);
+ int32 *ptr = ARRPTR(query);
BITVEC qp;
BITVECP dq,
de;
{ /* ltree */
ltree_gist *key;
ArrayType *val = DatumGetArrayTypeP(entry->key);
- int4 len = LTG_HDRSIZE + ASIGLEN;
+ int32 len = LTG_HDRSIZE + ASIGLEN;
int num = ArrayGetNItems(ARR_NDIM(val), ARR_DIMS(val));
ltree *item = (ltree *) ARR_DATA_PTR(val);
}
else if (!LTG_ISALLTRUE(entry->key))
{
- int4 i,
+ int32 i,
len;
ltree_gist *key;
*result = false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = LTG_SIGN(a),
sb = LTG_SIGN(b);
PG_RETURN_POINTER(result);
}
-static int4
+static int32
unionkey(BITVECP sbase, ltree_gist *add)
{
- int4 i;
+ int32 i;
BITVECP sadd = LTG_SIGN(add);
if (LTG_ISALLTRUE(add))
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int *size = (int *) PG_GETARG_POINTER(1);
ABITVEC base;
- int4 i,
+ int32 i,
len;
- int4 flag = 0;
+ int32 flag = 0;
ltree_gist *result;
MemSet((void *) base, 0, sizeof(ABITVEC));
PG_RETURN_POINTER(result);
}
-static int4
+static int32
sizebitvec(BITVECP sign)
{
- int4 size = 0,
+ int32 size = 0,
i;
ALOOPBYTE
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
*datum_r;
BITVECP union_l,
union_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
typedef struct
{
- int4 val;
+ int32 val;
uint16 len;
uint8 flag;
char name[1];
*/
typedef struct ITEM
{
- int2 type;
- int2 left;
- int4 val;
+ int16 type;
+ int16 left;
+ int32 val;
uint8 flag;
/* user-friendly value */
uint8 length;
typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 size;
+ int32 size;
char data[1];
} ltxtquery;
-#define HDRSIZEQT MAXALIGN(VARHDRSZ + sizeof(int4))
+#define HDRSIZEQT MAXALIGN(VARHDRSZ + sizeof(int32))
#define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + (size) * sizeof(ITEM) + (lenofoperand) )
#define GETQUERY(x) (ITEM*)( (char*)(x)+HDRSIZEQT )
#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((ltxtquery*)x)->size * sizeof(ITEM) )
#define BITBYTE 8
#define SIGLENINT 2
-#define SIGLEN ( sizeof(int4)*SIGLENINT )
+#define SIGLEN ( sizeof(int32)*SIGLENINT )
#define SIGLENBIT (SIGLEN*BITBYTE)
typedef unsigned char BITVEC[SIGLEN];
typedef unsigned char *BITVECP;
/* GiST support for ltree[] */
#define ASIGLENINT (7)
-#define ASIGLEN (sizeof(int4)*ASIGLENINT)
+#define ASIGLEN (sizeof(int32)*ASIGLENINT)
#define ASIGLENBIT (ASIGLEN*BITBYTE)
typedef unsigned char ABITVEC[ASIGLEN];
{ /* ltree */
ltree_gist *key;
ltree *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
- int4 len = LTG_HDRSIZE + VARSIZE(val);
+ int32 len = LTG_HDRSIZE + VARSIZE(val);
key = (ltree_gist *) palloc(len);
SET_VARSIZE(key, len);
*result = (ISEQ(LTG_NODE(a), LTG_NODE(b))) ? true : false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = LTG_SIGN(a),
sb = LTG_SIGN(b);
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int *size = (int *) PG_GETARG_POINTER(1);
BITVEC base;
- int4 i,
+ int32 i,
j;
ltree_gist *result,
*cur;
ltree_gist *origval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
ltree_gist *newval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
float *penalty = (float *) PG_GETARG_POINTER(2);
- int4 cmpr,
+ int32 cmpr,
cmpl;
cmpl = ltree_compare(LTG_GETLNODE(origval), LTG_GETLNODE(newval));
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
OffsetNumber j;
- int4 i;
+ int32 i;
RIX *array;
OffsetNumber maxoff;
int nbytes;
static bool
gist_isparent(ltree_gist *key, ltree *query)
{
- int4 numlevel = query->numlevel;
+ int32 numlevel = query->numlevel;
int i;
for (i = query->numlevel; i >= 0; i--)
static ltree *
-inner_subltree(ltree *t, int4 startpos, int4 endpos)
+inner_subltree(ltree *t, int32 startpos, int32 endpos)
{
char *start = NULL,
*end = NULL;
subpath(PG_FUNCTION_ARGS)
{
ltree *t = PG_GETARG_LTREE(0);
- int4 start = PG_GETARG_INT32(1);
- int4 len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
- int4 end;
+ int32 start = PG_GETARG_INT32(1);
+ int32 len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
+ int32 end;
ltree *res;
end = start + len;
*/
typedef struct NODE
{
- int4 type;
- int4 val;
- int2 distance;
- int2 length;
+ int32 type;
+ int32 val;
+ int16 distance;
+ int16 length;
uint16 flag;
struct NODE *next;
} NODE;
typedef struct
{
char *buf;
- int4 state;
- int4 count;
+ int32 state;
+ int32 count;
/* reverse polish notation in list (for temporary usage) */
NODE *str;
/* number in str */
- int4 num;
+ int32 num;
/* user-friendly operand */
- int4 lenop;
- int4 sumlen;
+ int32 lenop;
+ int32 sumlen;
char *op;
char *curop;
} QPRS_STATE;
/*
* get token from query string
*/
-static int4
-gettoken_query(QPRS_STATE *state, int4 *val, int4 *lenval, char **strval, uint16 *flag)
+static int32
+gettoken_query(QPRS_STATE *state, int32 *val, int32 *lenval, char **strval, uint16 *flag)
{
int charlen;
if (charlen == 1 && t_iseq(state->buf, '!'))
{
(state->buf)++;
- *val = (int4) '!';
+ *val = (int32) '!';
return OPR;
}
else if (charlen == 1 && t_iseq(state->buf, '('))
if (charlen == 1 && (t_iseq(state->buf, '&') || t_iseq(state->buf, '|')))
{
state->state = WAITOPERAND;
- *val = (int4) *(state->buf);
+ *val = (int32) *(state->buf);
(state->buf)++;
return OPR;
}
* push new one in polish notation reverse view
*/
static void
-pushquery(QPRS_STATE *state, int4 type, int4 val, int4 distance, int4 lenval, uint16 flag)
+pushquery(QPRS_STATE *state, int32 type, int32 val, int32 distance, int32 lenval, uint16 flag)
{
NODE *tmp = (NODE *) palloc(sizeof(NODE));
while (state->curop - state->op + lenval + 1 >= state->lenop)
{
- int4 tmp = state->curop - state->op;
+ int32 tmp = state->curop - state->op;
state->lenop *= 2;
state->op = (char *) repalloc((void *) state->op, state->lenop);
/*
* make polish notaion of query
*/
-static int4
+static int32
makepol(QPRS_STATE *state)
{
- int4 val = 0,
+ int32 val = 0,
type;
- int4 lenval = 0;
+ int32 lenval = 0;
char *strval = NULL;
- int4 stack[STACKDEPTH];
- int4 lenstack = 0;
+ int32 stack[STACKDEPTH];
+ int32 lenstack = 0;
uint16 flag = 0;
while ((type = gettoken_query(state, &val, &lenval, &strval, &flag)) != END)
{
case VAL:
pushval_asis(state, VAL, strval, lenval, flag);
- while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
- stack[lenstack - 1] == (int4) '!'))
+ while (lenstack && (stack[lenstack - 1] == (int32) '&' ||
+ stack[lenstack - 1] == (int32) '!'))
{
lenstack--;
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
}
break;
case OPR:
- if (lenstack && val == (int4) '|')
+ if (lenstack && val == (int32) '|')
pushquery(state, OPR, val, 0, 0, 0);
else
{
case OPEN:
if (makepol(state) == ERR)
return ERR;
- while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
- stack[lenstack - 1] == (int4) '!'))
+ while (lenstack && (stack[lenstack - 1] == (int32) '&' ||
+ stack[lenstack - 1] == (int32) '!'))
{
lenstack--;
pushquery(state, OPR, stack[lenstack], 0, 0, 0);
}
static void
-findoprnd(ITEM *ptr, int4 *pos)
+findoprnd(ITEM *ptr, int32 *pos)
{
if (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE)
{
ptr[*pos].left = 0;
(*pos)++;
}
- else if (ptr[*pos].val == (int4) '!')
+ else if (ptr[*pos].val == (int32) '!')
{
ptr[*pos].left = 1;
(*pos)++;
else
{
ITEM *curitem = &ptr[*pos];
- int4 tmp = *pos;
+ int32 tmp = *pos;
(*pos)++;
findoprnd(ptr, pos);
queryin(char *buf)
{
QPRS_STATE state;
- int4 i;
+ int32 i;
ltxtquery *query;
- int4 commonlen;
+ int32 commonlen;
ITEM *ptr;
NODE *tmp;
- int4 pos = 0;
+ int32 pos = 0;
#ifdef BS_DEBUG
char pbuf[16384],
char *buf;
char *cur;
char *op;
- int4 buflen;
+ int32 buflen;
} INFIX;
#define RESIZEBUF(inf,addsize) \
while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \
{ \
- int4 len = (inf)->cur - (inf)->buf; \
+ int32 len = (inf)->cur - (inf)->buf; \
(inf)->buflen *= 2; \
(inf)->buf = (char*) repalloc( (void*)(inf)->buf, (inf)->buflen ); \
(inf)->cur = (inf)->buf + len; \
*(in->cur) = '\0';
in->curpol++;
}
- else if (in->curpol->val == (int4) '!')
+ else if (in->curpol->val == (int32) '!')
{
bool isopr = false;
}
else
{
- int4 op = in->curpol->val;
+ int32 op = in->curpol->val;
INFIX nrm;
in->curpol++;
- if (op == (int4) '|' && !first)
+ if (op == (int32) '|' && !first)
{
RESIZEBUF(in, 2);
sprintf(in->cur, "( ");
in->cur = strchr(in->cur, '\0');
pfree(nrm.buf);
- if (op == (int4) '|' && !first)
+ if (op == (int32) '|' && !first)
{
RESIZEBUF(in, 2);
sprintf(in->cur, " )");
{
if (curitem->type == VAL)
return (*chkcond) (checkval, curitem);
- else if (curitem->val == (int4) '!')
+ else if (curitem->val == (int32) '!')
{
return (calcnot) ?
((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true)
: true;
}
- else if (curitem->val == (int4) '&')
+ else if (curitem->val == (int32) '&')
{
if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond))
return ltree_execute(curitem + 1, checkval, calcnot, chkcond);
static void
makesign(BITVECP sign, TRGM *a)
{
- int4 k,
+ int32 k,
len = ARRNELEM(a);
trgm *ptr = GETARR(a);
- int4 tmp = 0;
+ int32 tmp = 0;
MemSet((void *) sign, 0, sizeof(BITVEC));
SETBIT(sign, SIGLENBIT); /* set last unused bit */
else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
!ISALLTRUE(DatumGetPointer(entry->key)))
{
- int4 i,
+ int32 i,
len;
TRGM *res;
BITVECP sign = GETSIGN(DatumGetPointer(entry->key));
}
}
-static int4
+static int32
cnt_sml_sign_common(TRGM *qtrg, BITVECP sign)
{
- int4 count = 0;
- int4 k,
+ int32 count = 0;
+ int32 k,
len = ARRNELEM(qtrg);
trgm *ptr = GETARR(qtrg);
- int4 tmp = 0;
+ int32 tmp = 0;
for (k = 0; k < len; k++)
{
}
else
{ /* non-leaf contains signature */
- int4 count = cnt_sml_sign_common(qtrg, GETSIGN(key));
- int4 len = ARRNELEM(qtrg);
+ int32 count = cnt_sml_sign_common(qtrg, GETSIGN(key));
+ int32 len = ARRNELEM(qtrg);
if (len == 0)
res = false;
}
else
{ /* non-leaf contains signature */
- int4 count = cnt_sml_sign_common(qtrg, GETSIGN(key));
- int4 len = ARRNELEM(qtrg);
+ int32 count = cnt_sml_sign_common(qtrg, GETSIGN(key));
+ int32 len = ARRNELEM(qtrg);
res = (len == 0) ? -1.0 : 1.0 - ((float8) count) / ((float8) len);
}
PG_RETURN_FLOAT8(res);
}
-static int4
+static int32
unionkey(BITVECP sbase, TRGM *add)
{
- int4 i;
+ int32 i;
if (ISSIGNKEY(add))
{
else
{
trgm *ptr = GETARR(add);
- int4 tmp = 0;
+ int32 tmp = 0;
for (i = 0; i < ARRNELEM(add); i++)
{
gtrgm_union(PG_FUNCTION_ARGS)
{
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
- int4 len = entryvec->n;
+ int32 len = entryvec->n;
int *size = (int *) PG_GETARG_POINTER(1);
BITVEC base;
- int4 i;
- int4 flag = 0;
+ int32 i;
+ int32 flag = 0;
TRGM *result;
MemSet((void *) base, 0, sizeof(BITVEC));
*result = false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = GETSIGN(a),
sb = GETSIGN(b);
}
else
{ /* a and b ISARRKEY */
- int4 lena = ARRNELEM(a),
+ int32 lena = ARRNELEM(a),
lenb = ARRNELEM(b);
if (lena != lenb)
{
trgm *ptra = GETARR(a),
*ptrb = GETARR(b);
- int4 i;
+ int32 i;
*result = true;
for (i = 0; i < lena; i++)
PG_RETURN_POINTER(result);
}
-static int4
+static int32
sizebitvec(BITVECP sign)
{
- int4 size = 0,
+ int32 size = 0,
i;
LOOPBYTE
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
*datum_r;
BITVECP union_l,
union_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
/* 4-byte integer, passed by value */
typedef int int4;
</programlisting>
+
+ (The actual PostgreSQL C code calls this type <type>int32</type>, because
+ it is a convention in C that <type>int<replaceable>XX</replaceable></type>
+ means <replaceable>XX</replaceable> <emphasis>bits</emphasis>. Note
+ therefore also that the C type <type>int8</type> is 1 byte in size. The
+ SQL type <type>int8</type> is called <type>int64</type> in C. See also
+ <xref linkend="xfunc-c-type-table">.)
</para>
<para>
<programlisting>
typedef struct {
- int4 length;
+ int32 length;
char data[1];
} text;
</programlisting>
</row>
<row>
<entry><type>smallint</type> (<type>int2</type>)</entry>
- <entry><type>int2</type> or <type>int16</type></entry>
+ <entry><type>int16</type></entry>
<entry><filename>postgres.h</filename></entry>
</row>
<row>
</row>
<row>
<entry><type>integer</type> (<type>int4</type>)</entry>
- <entry><type>int4</type> or <type>int32</type></entry>
+ <entry><type>int32</type></entry>
<entry><filename>postgres.h</filename></entry>
</row>
<row>
{
int2vector *key = (int2vector *) PG_GETARG_POINTER(0);
- return hash_any((unsigned char *) key->values, key->dim1 * sizeof(int2));
+ return hash_any((unsigned char *) key->values, key->dim1 * sizeof(int16));
}
Datum
* Points on one of the axes are taken to lie in the lowest-numbered
* adjacent quadrant.
*/
-static int2
+static int16
getQuadrant(Point *centroid, Point *tst)
{
if ((SPTEST(point_above, tst, centroid) ||
# There are a few types which are given one name in the C source, but a
# different name at the SQL level. These are enumerated here.
my %RENAME_ATTTYPE = (
+ 'int16' => 'int2',
+ 'int32' => 'int4',
'Oid' => 'oid',
'NameData' => 'name',
'TransactionId' => 'xid'
* FindDefaultConversionProc - find default encoding conversion proc
*/
Oid
-FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
+FindDefaultConversionProc(int32 for_encoding, int32 to_encoding)
{
Oid proc;
ListCell *l;
values[Anum_pg_type_typname - 1] = NameGetDatum(&name);
values[Anum_pg_type_typnamespace - 1] = ObjectIdGetDatum(typeNamespace);
values[Anum_pg_type_typowner - 1] = ObjectIdGetDatum(ownerId);
- values[Anum_pg_type_typlen - 1] = Int16GetDatum(sizeof(int4));
+ values[Anum_pg_type_typlen - 1] = Int16GetDatum(sizeof(int32));
values[Anum_pg_type_typbyval - 1] = BoolGetDatum(true);
values[Anum_pg_type_typtype - 1] = CharGetDatum(TYPTYPE_PSEUDO);
values[Anum_pg_type_typcategory - 1] = CharGetDatum(TYPCATEGORY_PSEUDOTYPE);
/* swap size statistics too, since new rel has freshly-updated stats */
{
- int4 swap_pages;
+ int32 swap_pages;
float4 swap_tuples;
- int4 swap_allvisible;
+ int32 swap_allvisible;
swap_pages = relform1->relpages;
relform1->relpages = relform2->relpages;
{
int16 tgtype;
int ncolumns;
- int2 *columns;
+ int16 *columns;
int2vector *tgattr;
Node *whenClause;
List *whenRtable;
ListCell *cell;
int i = 0;
- columns = (int2 *) palloc(ncolumns * sizeof(int2));
+ columns = (int16 *) palloc(ncolumns * sizeof(int16));
foreach(cell, stmt->columns)
{
char *name = strVal(lfirst(cell));
- int2 attnum;
+ int16 attnum;
int j;
/* Lookup column name. System columns are not allowed */
build->tgnattr = pg_trigger->tgattr.dim1;
if (build->tgnattr > 0)
{
- build->tgattr = (int2 *) palloc(build->tgnattr * sizeof(int2));
+ build->tgattr = (int16 *) palloc(build->tgnattr * sizeof(int16));
memcpy(build->tgattr, &(pg_trigger->tgattr.values),
- build->tgnattr * sizeof(int2));
+ build->tgnattr * sizeof(int16));
}
else
build->tgattr = NULL;
trigger->tgname = pstrdup(trigger->tgname);
if (trigger->tgnattr > 0)
{
- int2 *newattr;
+ int16 *newattr;
- newattr = (int2 *) palloc(trigger->tgnattr * sizeof(int2));
+ newattr = (int16 *) palloc(trigger->tgnattr * sizeof(int16));
memcpy(newattr, trigger->tgattr,
- trigger->tgnattr * sizeof(int2));
+ trigger->tgnattr * sizeof(int16));
trigger->tgattr = newattr;
}
if (trigger->tgnargs > 0)
return false;
if (trig1->tgnattr > 0 &&
memcmp(trig1->tgattr, trig2->tgattr,
- trig1->tgnattr * sizeof(int2)) != 0)
+ trig1->tgnattr * sizeof(int16)) != 0)
return false;
for (j = 0; j < trig1->tgnargs; j++)
if (strcmp(trig1->tgargs[j], trig2->tgargs[j]) != 0)
expr = (Node *) makeConst(INT4OID,
-1,
InvalidOid,
- sizeof(int4),
+ sizeof(int32),
Int32GetDatum(flag),
false,
true);
for (i = 0; i < index_form->indnatts; i++)
{
- int2 attnum = index_form->indkey.values[i];
+ int16 attnum = index_form->indkey.values[i];
Form_pg_attribute attform;
char *attname;
Oid defopclass;
}
static int
-uniqueWORD(ParsedWord *a, int4 l)
+uniqueWORD(ParsedWord *a, int32 l)
{
ParsedWord *ptr,
*res;
* and different variants are ORred together.
*/
static void
-pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, int2 weight, bool prefix)
+pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, int16 weight, bool prefix)
{
- int4 count = 0;
+ int32 count = 0;
ParsedText prs;
uint32 variant,
pos,
text *in = PG_GETARG_TEXT_P(1);
TSQuery query;
QueryItem *res;
- int4 len;
+ int32 len;
query = parse_tsquery(text_to_cstring(in), pushval_morph, ObjectIdGetDatum(cfgid), false);
if (len != query->size)
{
char *oldoperand = GETOPERAND(query);
- int4 lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
+ int32 lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
Assert(len < query->size);
text *in = PG_GETARG_TEXT_P(1);
TSQuery query;
QueryItem *res;
- int4 len;
+ int32 len;
query = parse_tsquery(text_to_cstring(in), pushval_morph, ObjectIdGetDatum(cfgid), true);
if (len != query->size)
{
char *oldoperand = GETOPERAND(query);
- int4 lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
+ int32 lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
Assert(len < query->size);
char *ptr;
int len = 128;
int numfragments = 0;
- int2 infrag = 0;
+ int16 infrag = 0;
HeadlineWordEntry *wrd = prs->words;
typedef struct
{
- int4 startpos;
- int4 endpos;
- int4 poslen;
- int4 curlen;
- int2 in;
- int2 excluded;
+ int32 startpos;
+ int32 endpos;
+ int32 poslen;
+ int32 curlen;
+ int16 in;
+ int16 excluded;
} CoverPos;
static void
int shortword, int min_words,
int max_words, int max_fragments)
{
- int4 poslen,
+ int32 poslen,
curlen,
i,
f,
num_f = 0;
- int4 stretch,
+ int32 stretch,
maxstretch,
posmarker;
- int4 startpos = 0,
+ int32 startpos = 0,
endpos = 0,
p = 0,
q = 0;
- int4 numcovers = 0,
+ int32 numcovers = 0,
maxcovers = 32;
- int4 minI,
+ int32 minI,
minwords,
maxitems;
CoverPos *covers;
typedef struct generate_subscripts_fctx
{
- int4 lower;
- int4 upper;
+ int32 lower;
+ int32 upper;
bool reverse;
} generate_subscripts_fctx;
#define SAMESIGN(a,b) (((a) < 0) == ((b) < 0))
-#define Int2VectorSize(n) (offsetof(int2vector, values) + (n) * sizeof(int2))
+#define Int2VectorSize(n) (offsetof(int2vector, values) + (n) * sizeof(int16))
typedef struct
{
* If int2s is NULL then caller must fill values[] afterward
*/
int2vector *
-buildint2vector(const int2 *int2s, int n)
+buildint2vector(const int16 *int2s, int n)
{
int2vector *result;
result = (int2vector *) palloc0(Int2VectorSize(n));
if (n > 0 && int2s)
- memcpy(result->values, int2s, n * sizeof(int2));
+ memcpy(result->values, int2s, n * sizeof(int16));
/*
* Attach standard array header. For historical reasons, we set the index
if (a->dim1 != b->dim1)
PG_RETURN_BOOL(false);
- PG_RETURN_BOOL(memcmp(a->values, b->values, a->dim1 * sizeof(int2)) == 0);
+ PG_RETURN_BOOL(memcmp(a->values, b->values, a->dim1 * sizeof(int16)) == 0);
}
char *rulename;
char ev_type;
Oid ev_class;
- int2 ev_attr;
+ int16 ev_attr;
bool is_instead;
char *ev_qual;
char *ev_action;
Query *query;
char ev_type;
Oid ev_class;
- int2 ev_attr;
+ int16 ev_attr;
bool is_instead;
char *ev_qual;
char *ev_action;
ev_class = (Oid) SPI_getbinval(ruletup, rulettc, fno, &isnull);
fno = SPI_fnumber(rulettc, "ev_attr");
- ev_attr = (int2) SPI_getbinval(ruletup, rulettc, fno, &isnull);
+ ev_attr = (int16) SPI_getbinval(ruletup, rulettc, fno, &isnull);
fno = SPI_fnumber(rulettc, "is_instead");
is_instead = (bool) SPI_getbinval(ruletup, rulettc, fno, &isnull);
if (query->size > 0)
{
QueryItem *item = GETQUERY(query);
- int4 i,
+ int32 i,
j;
bool *partialmatch;
int *map_item_operand;
#define SIGLENINT 31 /* >121 => key will toast, so it will not work
* !!! */
-#define SIGLEN ( sizeof(int4) * SIGLENINT )
+#define SIGLEN ( sizeof(int32) * SIGLENINT )
#define SIGLENBIT (SIGLEN * BITS_PER_BYTE)
typedef char BITVEC[SIGLEN];
typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 flag;
+ int32 flag;
char data[1];
} SignTSVector;
#define ISSIGNKEY(x) ( ((SignTSVector*)(x))->flag & SIGNKEY )
#define ISALLTRUE(x) ( ((SignTSVector*)(x))->flag & ALLISTRUE )
-#define GTHDRSIZE ( VARHDRSZ + sizeof(int4) )
-#define CALCGTSIZE(flag, len) ( GTHDRSIZE + ( ( (flag) & ARRKEY ) ? ((len)*sizeof(int4)) : (((flag) & ALLISTRUE) ? 0 : SIGLEN) ) )
+#define GTHDRSIZE ( VARHDRSZ + sizeof(int32) )
+#define CALCGTSIZE(flag, len) ( GTHDRSIZE + ( ( (flag) & ARRKEY ) ? ((len)*sizeof(int32)) : (((flag) & ALLISTRUE) ? 0 : SIGLEN) ) )
#define GETSIGN(x) ( (BITVECP)( (char*)(x)+GTHDRSIZE ) )
-#define GETARR(x) ( (int4*)( (char*)(x)+GTHDRSIZE ) )
-#define ARRNELEM(x) ( ( VARSIZE(x) - GTHDRSIZE )/sizeof(int4) )
+#define GETARR(x) ( (int32*)( (char*)(x)+GTHDRSIZE ) )
+#define ARRNELEM(x) ( ( VARSIZE(x) - GTHDRSIZE )/sizeof(int32) )
/* Number of one-bits in an unsigned byte */
static const uint8 number_of_ones[256] = {
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
};
-static int4 sizebitvec(BITVECP sign);
+static int32 sizebitvec(BITVECP sign);
Datum
gtsvectorin(PG_FUNCTION_ARGS)
static int
compareint(const void *va, const void *vb)
{
- int4 a = *((const int4 *) va);
- int4 b = *((const int4 *) vb);
+ int32 a = *((const int32 *) va);
+ int32 b = *((const int32 *) vb);
if (a == b)
return 0;
}
/*
- * Removes duplicates from an array of int4. 'l' is
+ * Removes duplicates from an array of int32. 'l' is
* size of the input array. Returns the new size of the array.
*/
static int
-uniqueint(int4 *a, int4 l)
+uniqueint(int32 *a, int32 l)
{
- int4 *ptr,
+ int32 *ptr,
*res;
if (l <= 1)
ptr = res = a;
- qsort((void *) a, l, sizeof(int4), compareint);
+ qsort((void *) a, l, sizeof(int32), compareint);
while (ptr - a < l)
if (*ptr != *res)
static void
makesign(BITVECP sign, SignTSVector *a)
{
- int4 k,
+ int32 k,
len = ARRNELEM(a);
- int4 *ptr = GETARR(a);
+ int32 *ptr = GETARR(a);
MemSet((void *) sign, 0, sizeof(BITVEC));
for (k = 0; k < len; k++)
{ /* tsvector */
SignTSVector *res;
TSVector val = DatumGetTSVector(entry->key);
- int4 len;
- int4 *arr;
+ int32 len;
+ int32 *arr;
WordEntry *ptr = ARRPTR(val);
char *words = STRPTR(val);
COMP_CRC32(c, words + ptr->pos, ptr->len);
FIN_CRC32(c);
- *arr = *(int4 *) &c;
+ *arr = *(int32 *) &c;
arr++;
ptr++;
}
else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
!ISALLTRUE(DatumGetPointer(entry->key)))
{
- int4 i,
+ int32 i,
len;
SignTSVector *res;
BITVECP sign = GETSIGN(DatumGetPointer(entry->key));
typedef struct
{
- int4 *arrb;
- int4 *arre;
+ int32 *arrb;
+ int32 *arre;
} CHKVAL;
/*
static bool
checkcondition_arr(void *checkval, QueryOperand *val)
{
- int4 *StopLow = ((CHKVAL *) checkval)->arrb;
- int4 *StopHigh = ((CHKVAL *) checkval)->arre;
- int4 *StopMiddle;
+ int32 *StopLow = ((CHKVAL *) checkval)->arrb;
+ int32 *StopHigh = ((CHKVAL *) checkval)->arre;
+ int32 *StopMiddle;
/* Loop invariant: StopLow <= val < StopHigh */
}
}
-static int4
+static int32
unionkey(BITVECP sbase, SignTSVector *add)
{
- int4 i;
+ int32 i;
if (ISSIGNKEY(add))
{
}
else
{
- int4 *ptr = GETARR(add);
+ int32 *ptr = GETARR(add);
for (i = 0; i < ARRNELEM(add); i++)
HASH(sbase, ptr[i]);
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int *size = (int *) PG_GETARG_POINTER(1);
BITVEC base;
- int4 i,
+ int32 i,
len;
- int4 flag = 0;
+ int32 flag = 0;
SignTSVector *result;
MemSet((void *) base, 0, sizeof(BITVEC));
*result = false;
else
{
- int4 i;
+ int32 i;
BITVECP sa = GETSIGN(a),
sb = GETSIGN(b);
}
else
{ /* a and b ISARRKEY */
- int4 lena = ARRNELEM(a),
+ int32 lena = ARRNELEM(a),
lenb = ARRNELEM(b);
if (lena != lenb)
*result = false;
else
{
- int4 *ptra = GETARR(a),
+ int32 *ptra = GETARR(a),
*ptrb = GETARR(b);
- int4 i;
+ int32 i;
*result = true;
for (i = 0; i < lena; i++)
PG_RETURN_POINTER(result);
}
-static int4
+static int32
sizebitvec(BITVECP sign)
{
- int4 size = 0,
+ int32 size = 0,
i;
LOOPBYTE
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
*datum_r;
BITVECP union_l,
union_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
* of the string.
*/
void
-pushValue(TSQueryParserState state, char *strval, int lenval, int2 weight, bool prefix)
+pushValue(TSQueryParserState state, char *strval, int lenval, int16 weight, bool prefix)
{
pg_crc32 valcrc;
typedef struct
{
OffsetNumber pos;
- int4 cost;
+ int32 cost;
} SPLITCOST;
static int
j;
TSQuerySign datum_l,
datum_r;
- int4 size_alpha,
+ int32 size_alpha,
size_beta;
- int4 size_waste,
+ int32 size_waste,
waste = -1;
- int4 nbytes;
+ int32 nbytes;
OffsetNumber seed_1 = 0,
seed_2 = 0;
OffsetNumber *left,
* Returns a weight of a word collocation
*/
static float4
-word_distance(int4 w)
+word_distance(int32 w)
{
if (w > 100)
return 1e-30f;
*firstentry;
WordEntryPos *post,
*ct;
- int4 dimt,
+ int32 dimt,
lenct,
dist,
nitem;
WordEntry *entry,
*firstentry;
WordEntryPos *post;
- int4 dimt,
+ int32 dimt,
j,
i,
nitem;
{
float resj,
wjm;
- int4 jm;
+ int32 jm;
firstentry = entry = find_wordentry(t, q, item[i], &nitem);
if (!entry)
}
static float
-calc_rank(float *w, TSVector t, TSQuery q, int4 method)
+calc_rank(float *w, TSVector t, TSQuery q, int32 method)
{
QueryItem *item = GETQUERY(q);
float res = 0.0;
WordEntry *entry,
*firstentry;
WordEntryPos *post;
- int4 dimt,
+ int32 dimt,
j,
i,
nitem;
{
TSVector out = PG_GETARG_TSVECTOR(0);
char *outbuf;
- int4 i,
+ int32 i,
lenbuf = 0,
pp;
WordEntry *ptr = ARRPTR(out);
typedef struct
{
- int4 weight;
+ int32 weight;
uint32 maxdepth;
tsvector_length(PG_FUNCTION_ARGS)
{
TSVector in = PG_GETARG_TSVECTOR(0);
- int4 ret = in->size;
+ int32 ret = in->size;
PG_FREE_IF_COPY(in, 0);
PG_RETURN_INT32(ret);
* Add positions from src to dest after offsetting them by maxpos.
* Return the number added (might be less than expected due to overflow)
*/
-static int4
+static int32
add_pos(TSVector src, WordEntry *srcptr,
TSVector dest, WordEntry *destptr,
- int4 maxpos)
+ int32 maxpos)
{
uint16 *clen = &_POSVECPTR(dest, destptr)->npos;
int i;
*
* if isPrefix = true then it returns zero value iff b has prefix a
*/
-int4
+int32
tsCompareString(char *a, int lena, char *b, int lenb, bool prefix)
{
int cmp;
*/
#define GinCategoryOffset(itup,ginstate) \
(IndexInfoFindDataOffset((itup)->t_info) + \
- ((ginstate)->oneCol ? 0 : sizeof(int2)))
+ ((ginstate)->oneCol ? 0 : sizeof(int16)))
#define GinGetNullCategory(itup,ginstate) \
(*((GinNullCategory *) ((char*)(itup) + GinCategoryOffset(itup,ginstate))))
#define GinSetNullCategory(itup,ginstate,c) \
/*
* Common Postgres datatype names (as used in the catalogs)
*/
-typedef int16 int2;
-typedef int32 int4;
typedef float float4;
typedef double float8;
Oid elemtype;
int dim1;
int lbound1;
- int2 values[1]; /* VARIABLE LENGTH ARRAY */
+ int16 values[1]; /* VARIABLE LENGTH ARRAY */
} int2vector; /* VARIABLE LENGTH STRUCT */
typedef struct
extern Oid get_collation_oid(List *collname, bool missing_ok);
extern Oid get_conversion_oid(List *conname, bool missing_ok);
-extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
+extern Oid FindDefaultConversionProc(int32 for_encoding, int32 to_encoding);
/* initialization & transaction cleanup code */
extern void InitializeSearchPath(void);
CATALOG(pg_am,2601)
{
NameData amname; /* access method name */
- int2 amstrategies; /* total number of strategies (operators) by
+ int16 amstrategies; /* total number of strategies (operators) by
* which we can traverse/search this AM. Zero
* if AM does not have a fixed set of strategy
* assignments. */
- int2 amsupport; /* total number of support functions that this
+ int16 amsupport; /* total number of support functions that this
* AM uses */
bool amcanorder; /* does AM support order by column value? */
bool amcanorderbyop; /* does AM support order by operator result? */
Oid amopfamily; /* the index opfamily this entry is for */
Oid amoplefttype; /* operator's left input data type */
Oid amoprighttype; /* operator's right input data type */
- int2 amopstrategy; /* operator strategy number */
+ int16 amopstrategy; /* operator strategy number */
char amoppurpose; /* is operator for 's'earch or 'o'rdering? */
Oid amopopr; /* the operator's pg_operator OID */
Oid amopmethod; /* the index access method this entry is for */
Oid amprocfamily; /* the index opfamily this entry is for */
Oid amproclefttype; /* procedure's left input data type */
Oid amprocrighttype; /* procedure's right input data type */
- int2 amprocnum; /* support procedure index */
+ int16 amprocnum; /* support procedure index */
regproc amproc; /* OID of the proc */
} FormData_pg_amproc;
CATALOG(pg_attrdef,2604)
{
Oid adrelid; /* OID of table containing attribute */
- int2 adnum; /* attnum of attribute */
+ int16 adnum; /* attnum of attribute */
#ifdef CATALOG_VARLEN /* variable-length fields start here */
pg_node_tree adbin; /* nodeToString representation of default */
* that no value has been explicitly set for this column, so ANALYZE
* should use the default setting.
*/
- int4 attstattarget;
+ int32 attstattarget;
/*
* attlen is a copy of the typlen field from pg_type for this attribute.
* See atttypid comments above.
*/
- int2 attlen;
+ int16 attlen;
/*
* attnum is the "attribute number" for the attribute: A value that
*
* Note that (attnum - 1) is often used as the index to an array.
*/
- int2 attnum;
+ int16 attnum;
/*
* attndims is the declared number of dimensions, if an array type,
* otherwise zero.
*/
- int4 attndims;
+ int32 attndims;
/*
* fastgetattr() uses attcacheoff to cache byte offsets of attributes in
* descriptor, we may then update attcacheoff in the copies. This speeds
* up the attribute walking process.
*/
- int4 attcacheoff;
+ int32 attcacheoff;
/*
* atttypmod records type-specific data supplied at table creation time
* type-specific input and output functions as the third argument. The
* value will generally be -1 for types that do not need typmod.
*/
- int4 atttypmod;
+ int32 atttypmod;
/*
* attbyval is a copy of the typbyval field from pg_type for this
bool attislocal;
/* Number of times inherited from direct parent relation(s) */
- int4 attinhcount;
+ int32 attinhcount;
/* attribute's collation */
Oid attcollation;
bool rolcatupdate; /* allowed to alter catalogs manually? */
bool rolcanlogin; /* allowed to log in as session user? */
bool rolreplication; /* role used for streaming replication */
- int4 rolconnlimit; /* max connections allowed (-1=no limit) */
+ int32 rolconnlimit; /* max connections allowed (-1=no limit) */
/* remaining fields may be null; use heap_getattr to read them! */
text rolpassword; /* password, if any */
/* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
Oid reltablespace; /* identifier of table space for relation */
- int4 relpages; /* # of blocks (not always up-to-date) */
+ int32 relpages; /* # of blocks (not always up-to-date) */
float4 reltuples; /* # of tuples (not always up-to-date) */
- int4 relallvisible; /* # of all-visible blocks (not always
+ int32 relallvisible; /* # of all-visible blocks (not always
* up-to-date) */
Oid reltoastrelid; /* OID of toast table; 0 if none */
Oid reltoastidxid; /* if toast table, OID of chunk_id index */
bool relisshared; /* T if shared across databases */
char relpersistence; /* see RELPERSISTENCE_xxx constants below */
char relkind; /* see RELKIND_xxx constants below */
- int2 relnatts; /* number of user attributes */
+ int16 relnatts; /* number of user attributes */
/*
* Class pg_attribute must contain exactly "relnatts" user attributes
* (with attnums ranging from 1 to relnatts) for this class. It may also
* contain entries with negative attnums for system attributes.
*/
- int2 relchecks; /* # of CHECK constraints for class */
+ int16 relchecks; /* # of CHECK constraints for class */
bool relhasoids; /* T if we generate OIDs for rows of rel */
bool relhaspkey; /* has (or has had) PRIMARY KEY index */
bool relhasrules; /* has (or has had) any rules */
NameData collname; /* collation name */
Oid collnamespace; /* OID of namespace containing collation */
Oid collowner; /* owner of collation */
- int4 collencoding; /* encoding for this collation; -1 = "all" */
+ int32 collencoding; /* encoding for this collation; -1 = "all" */
NameData collcollate; /* LC_COLLATE setting */
NameData collctype; /* LC_CTYPE setting */
} FormData_pg_collation;
bool conislocal;
/* Number of times inherited from direct parent relation(s) */
- int4 coninhcount;
+ int32 coninhcount;
/* Has a local definition and cannot be inherited */
bool connoinherit;
* Columns of conrelid that the constraint applies to, if known (this is
* NULL for trigger constraints)
*/
- int2 conkey[1];
+ int16 conkey[1];
/*
* If a foreign key, the referenced columns of confrelid
*/
- int2 confkey[1];
+ int16 confkey[1];
/*
* If a foreign key, the OIDs of the PK = FK equality operators for each
NameData conname;
Oid connamespace;
Oid conowner;
- int4 conforencoding;
- int4 contoencoding;
+ int32 conforencoding;
+ int32 contoencoding;
regproc conproc;
bool condefault;
} FormData_pg_conversion;
{
NameData datname; /* database name */
Oid datdba; /* owner of database */
- int4 encoding; /* character encoding */
+ int32 encoding; /* character encoding */
NameData datcollate; /* LC_COLLATE setting */
NameData datctype; /* LC_CTYPE setting */
bool datistemplate; /* allowed as CREATE DATABASE template? */
bool datallowconn; /* new connections allowed? */
- int4 datconnlimit; /* max connections allowed (-1=no limit) */
+ int32 datconnlimit; /* max connections allowed (-1=no limit) */
Oid datlastsysoid; /* highest OID to consider a system OID */
TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */
Oid dattablespace; /* default table space for this DB */
*/
Oid classid; /* OID of table containing object */
Oid objid; /* OID of object itself */
- int4 objsubid; /* column number, or 0 if not used */
+ int32 objsubid; /* column number, or 0 if not used */
/*
* Identification of the independent (referenced) object.
*/
Oid refclassid; /* OID of table containing object */
Oid refobjid; /* OID of object itself */
- int4 refobjsubid; /* column number, or 0 if not used */
+ int32 refobjsubid; /* column number, or 0 if not used */
/*
* Precise semantics of the relationship are specified by the deptype
{
Oid objoid; /* OID of object itself */
Oid classoid; /* OID of table containing object */
- int4 objsubid; /* column number, or 0 if not used */
+ int32 objsubid; /* column number, or 0 if not used */
#ifdef CATALOG_VARLEN /* variable-length fields start here */
text description; /* description of object */
{
Oid indexrelid; /* OID of the index */
Oid indrelid; /* OID of the relation it indexes */
- int2 indnatts; /* number of columns in index */
+ int16 indnatts; /* number of columns in index */
bool indisunique; /* is this a unique index? */
bool indisprimary; /* is this index for primary key? */
bool indisexclusion; /* is this index for exclusion constraint? */
{
Oid inhrelid;
Oid inhparent;
- int4 inhseqno;
+ int32 inhseqno;
} FormData_pg_inherits;
/* ----------------
CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS
{
Oid loid; /* Identifier of large object */
- int4 pageno; /* Page number (starting from 0) */
+ int32 pageno; /* Page number (starting from 0) */
/* data has variable length, but we allow direct access; see inv_api.c */
bytea data; /* Data for page (may be zero-length) */
bool proisstrict; /* strict with respect to NULLs? */
bool proretset; /* returns a set? */
char provolatile; /* see PROVOLATILE_ categories below */
- int2 pronargs; /* number of arguments */
- int2 pronargdefaults; /* number of arguments with defaults */
+ int16 pronargs; /* number of arguments */
+ int16 pronargdefaults; /* number of arguments with defaults */
Oid prorettype; /* OID of result type */
/*
{
NameData rulename;
Oid ev_class;
- int2 ev_attr;
+ int16 ev_attr;
char ev_type;
char ev_enabled;
bool is_instead;
{
Oid objoid; /* OID of the object itself */
Oid classoid; /* OID of table containing the object */
- int4 objsubid; /* column number, or 0 if not used */
+ int32 objsubid; /* column number, or 0 if not used */
#ifdef CATALOG_VARLEN /* variable-length fields start here */
text provider; /* name of label provider */
Oid dbid; /* OID of database containing object */
Oid classid; /* OID of table containing object */
Oid objid; /* OID of object itself */
- int4 objsubid; /* column number, or 0 if not used */
+ int32 objsubid; /* column number, or 0 if not used */
/*
* Identification of the independent (referenced) object. This is always
{
/* These fields form the unique key for the entry: */
Oid starelid; /* relation containing attribute */
- int2 staattnum; /* attribute (column) stats are for */
+ int16 staattnum; /* attribute (column) stats are for */
bool stainherit; /* true if inheritance children are included */
/* the fraction of the column's entries that are NULL: */
* the statistic, which is to estimate sizes of in-memory hash tables of
* tuples.
*/
- int4 stawidth;
+ int32 stawidth;
/* ----------------
* stadistinct indicates the (approximate) number of distinct non-null
* ----------------
*/
- int2 stakind1;
- int2 stakind2;
- int2 stakind3;
- int2 stakind4;
- int2 stakind5;
+ int16 stakind1;
+ int16 stakind2;
+ int16 stakind3;
+ int16 stakind4;
+ int16 stakind5;
Oid staop1;
Oid staop2;
Oid tgrelid; /* relation trigger is attached to */
NameData tgname; /* trigger's name */
Oid tgfoid; /* OID of function to be called */
- int2 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT,
+ int16 tgtype; /* BEFORE/AFTER/INSTEAD, UPDATE/DELETE/INSERT,
* ROW/STATEMENT; see below */
char tgenabled; /* trigger's firing configuration WRT
* session_replication_role */
Oid tgconstraint; /* associated pg_constraint entry, if any */
bool tgdeferrable; /* constraint trigger is deferrable */
bool tginitdeferred; /* constraint trigger is deferred initially */
- int2 tgnargs; /* # of extra arguments in tgargs */
+ int16 tgnargs; /* # of extra arguments in tgargs */
/*
* Variable-length fields start here, but we allow direct access to
CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS
{
Oid mapcfg; /* OID of configuration owning this entry */
- int4 maptokentype; /* token type from parser */
- int4 mapseqno; /* order in which to consult dictionaries */
+ int32 maptokentype; /* token type from parser */
+ int32 mapseqno; /* order in which to consult dictionaries */
Oid mapdict; /* dictionary to consult */
} FormData_pg_ts_config_map;
* "varlena" type (one that has a length word), -2 to indicate a
* null-terminated C string.
*/
- int2 typlen;
+ int16 typlen;
/*
* typbyval determines whether internal Postgres routines pass a value of
* type (-1 if base type does not use a typmod). -1 if this type is not a
* domain.
*/
- int4 typtypmod;
+ int32 typtypmod;
/*
* typndims is the declared number of dimensions for an array domain type
* (i.e., typbasetype is an array type). Otherwise zero.
*/
- int4 typndims;
+ int32 typndims;
/*
* Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for
*/
bool stats_valid;
float4 stanullfrac; /* fraction of entries that are NULL */
- int4 stawidth; /* average width of column values */
+ int32 stawidth; /* average width of column values */
float4 stadistinct; /* # distinct values */
- int2 stakind[STATISTIC_NUM_SLOTS];
+ int16 stakind[STATISTIC_NUM_SLOTS];
Oid staop[STATISTIC_NUM_SLOTS];
int numnumbers[STATISTIC_NUM_SLOTS];
float4 *stanumbers[STATISTIC_NUM_SLOTS];
* elements. It should then overwrite these fields.
*/
Oid statypid[STATISTIC_NUM_SLOTS];
- int2 statyplen[STATISTIC_NUM_SLOTS];
+ int16 statyplen[STATISTIC_NUM_SLOTS];
bool statypbyval[STATISTIC_NUM_SLOTS];
char statypalign[STATISTIC_NUM_SLOTS];
typedef struct
{
HeadlineWordEntry *words;
- int4 lenwords;
- int4 curwords;
+ int32 lenwords;
+ int32 curwords;
char *startsel;
char *stopsel;
char *fragdelim;
- int2 startsellen;
- int2 stopsellen;
- int2 fragdelimlen;
+ int16 startsellen;
+ int16 stopsellen;
+ int16 fragdelimlen;
} HeadlineParsedText;
/*
*
* Structure of tsvector datatype:
* 1) standard varlena header
- * 2) int4 size - number of lexemes (WordEntry array entries)
+ * 2) int32 size - number of lexemes (WordEntry array entries)
* 3) Array of WordEntry - one per lexeme; must be sorted according to
* tsCompareString() (ie, memcmp of lexeme strings).
* WordEntry->pos gives the number of bytes from end of WordEntry
typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
- int4 size; /* number of QueryItems */
+ int32 size; /* number of QueryItems */
char data[1]; /* data starts here */
} TSQueryData;
typedef TSQueryData *TSQuery;
-#define HDRSIZETQ ( VARHDRSZ + sizeof(int4) )
+#define HDRSIZETQ ( VARHDRSZ + sizeof(int32) )
/* Computes the size of header and all QueryItems. size is the number of
* QueryItems, and lenofoperand is the total length of all operands
typedef void (*PushFunction) (Datum opaque, TSQueryParserState state,
char *token, int tokenlen,
- int2 tokenweights, /* bitmap as described
+ int16 tokenweights, /* bitmap as described
* in QueryOperand
* struct */
bool prefix);
/* Functions for use by PushFunction implementations */
extern void pushValue(TSQueryParserState state,
- char *strval, int lenval, int2 weight, bool prefix);
+ char *strval, int lenval, int16 weight, bool prefix);
extern void pushStop(TSQueryParserState state);
extern void pushOperator(TSQueryParserState state, int8 oper);
typedef struct
{
ParsedWord *words;
- int4 lenwords;
- int4 curwords;
- int4 pos;
+ int32 lenwords;
+ int32 curwords;
+ int32 pos;
} ParsedText;
-extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int4 buflen);
+extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int32 buflen);
/*
* headline framework, flow in common to generate:
*/
extern void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query,
- char *buf, int4 buflen);
+ char *buf, int32 buflen);
extern text *generateHeadline(HeadlineParsedText *prs);
/*
/*
* TSQuery Utilities
*/
-extern QueryItem *clean_NOT(QueryItem *ptr, int4 *len);
-extern QueryItem *clean_fakeval(QueryItem *ptr, int4 *len);
+extern QueryItem *clean_NOT(QueryItem *ptr, int32 *len);
+extern QueryItem *clean_fakeval(QueryItem *ptr, int32 *len);
typedef struct QTNode
{
QueryItem *valnode;
uint32 flags;
- int4 nchild;
+ int32 nchild;
char *word;
uint32 sign;
struct QTNode **child;
extern Datum int2shr(PG_FUNCTION_ARGS);
extern Datum generate_series_int4(PG_FUNCTION_ARGS);
extern Datum generate_series_step_int4(PG_FUNCTION_ARGS);
-extern int2vector *buildint2vector(const int2 *int2s, int n);
+extern int2vector *buildint2vector(const int16 *int2s, int n);
/* name.c */
extern Datum namein(PG_FUNCTION_ARGS);
/*
* Sets values from PGresult.
*/
-static int2 value_is_null = -1;
-static int2 value_is_not_null = 0;
+static int16 value_is_null = -1;
+static int16 value_is_not_null = 0;
void
ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult *res, int row, enum COMPAT_MODE compat)