Replace int2/int4 in C code with int16/int32
authorPeter Eisentraut
Sun, 24 Jun 2012 22:51:46 +0000 (01:51 +0300)
committerPeter Eisentraut
Sun, 24 Jun 2012 22:51:46 +0000 (01:51 +0300)
The latter was already the dominant use, and it's preferable because
in C the convention is that intXX means XX bits.  Therefore, allowing
mixed use of int2, int4, int8, int16, int32 is obviously confusing.

Remove the typedefs for int2 and int4 for now.  They don't seem to be
widely used outside of the PostgreSQL source tree, and the few uses
can probably be cleaned up by the time this ships.

75 files changed:
contrib/btree_gist/btree_int2.c
contrib/btree_gist/btree_int4.c
contrib/cube/cube.c
contrib/hstore/hstore.h
contrib/hstore/hstore_gist.c
contrib/hstore/hstore_io.c
contrib/intarray/_int.h
contrib/intarray/_int_bool.c
contrib/intarray/_int_gin.c
contrib/intarray/_int_gist.c
contrib/intarray/_int_tool.c
contrib/intarray/_intbig_gist.c
contrib/ltree/_ltree_gist.c
contrib/ltree/ltree.h
contrib/ltree/ltree_gist.c
contrib/ltree/ltree_op.c
contrib/ltree/ltxtquery_io.c
contrib/ltree/ltxtquery_op.c
contrib/pg_trgm/trgm_gist.c
doc/src/sgml/xfunc.sgml
src/backend/access/hash/hashfunc.c
src/backend/access/spgist/spgquadtreeproc.c
src/backend/catalog/Catalog.pm
src/backend/catalog/namespace.c
src/backend/catalog/pg_type.c
src/backend/commands/cluster.c
src/backend/commands/trigger.c
src/backend/optimizer/prep/prepunion.c
src/backend/parser/parse_utilcmd.c
src/backend/tsearch/to_tsany.c
src/backend/tsearch/ts_parse.c
src/backend/tsearch/wparser_def.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/int.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/tsginidx.c
src/backend/utils/adt/tsgistidx.c
src/backend/utils/adt/tsquery.c
src/backend/utils/adt/tsquery_gist.c
src/backend/utils/adt/tsrank.c
src/backend/utils/adt/tsvector.c
src/backend/utils/adt/tsvector_op.c
src/include/access/gin_private.h
src/include/c.h
src/include/catalog/namespace.h
src/include/catalog/pg_am.h
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_attrdef.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_authid.h
src/include/catalog/pg_class.h
src/include/catalog/pg_collation.h
src/include/catalog/pg_constraint.h
src/include/catalog/pg_conversion.h
src/include/catalog/pg_database.h
src/include/catalog/pg_depend.h
src/include/catalog/pg_description.h
src/include/catalog/pg_index.h
src/include/catalog/pg_inherits.h
src/include/catalog/pg_largeobject.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_rewrite.h
src/include/catalog/pg_seclabel.h
src/include/catalog/pg_shdepend.h
src/include/catalog/pg_statistic.h
src/include/catalog/pg_trigger.h
src/include/catalog/pg_ts_config_map.h
src/include/catalog/pg_type.h
src/include/commands/vacuum.h
src/include/tsearch/ts_public.h
src/include/tsearch/ts_type.h
src/include/tsearch/ts_utils.h
src/include/utils/builtins.h
src/interfaces/ecpg/ecpglib/sqlda.c

index a40912b13d65b97151ac3cb3eb819e0629dbb7ec..6a438bf1f22390d542912eef1a1faebbface5834 100644 (file)
@@ -77,7 +77,7 @@ gbt_int2key_cmp(const void *a, const void *b)
 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);
 }
 
 
@@ -100,10 +100,10 @@ Datum     int2_dist(PG_FUNCTION_ARGS);
 Datum
 int2_dist(PG_FUNCTION_ARGS)
 {
-   int       a = PG_GETARG_INT16(0);
-   int       b = PG_GETARG_INT16(1);
-   int       r;
-   int       ra;
+   int16       a = PG_GETARG_INT16(0);
+   int16       b = PG_GETARG_INT16(1);
+   int16       r;
+   int16       ra;
 
    r = a - b;
    ra = Abs(r);
index 426f23f3fe09f039252c75fe9c038f694ec46338..df2164fc5eb6a45456aca953161bb292f5249a16 100644 (file)
@@ -78,7 +78,7 @@ gbt_int4key_cmp(const void *a, const void *b)
 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);
 }
 
 
@@ -101,10 +101,10 @@ Datum     int4_dist(PG_FUNCTION_ARGS);
 Datum
 int4_dist(PG_FUNCTION_ARGS)
 {
-   int       a = PG_GETARG_INT32(0);
-   int       b = PG_GETARG_INT32(1);
-   int       r;
-   int       ra;
+   int32       a = PG_GETARG_INT32(0);
+   int32       b = PG_GETARG_INT32(1);
+   int32       r;
+   int32       ra;
 
    r = a - b;
    ra = Abs(r);
index 1d119ddbb50bda9b4f08bece60c4db24f652acb9..b591133ec70b8f99a505236ac5fcab5f4a05e68c 100644 (file)
@@ -266,7 +266,7 @@ cube_subset(PG_FUNCTION_ARGS)
                (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;
@@ -1360,7 +1360,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
 {
    NDBOX      *a = PG_GETARG_NDBOX(0);
    double      r = PG_GETARG_FLOAT8(1);
-   int       n = PG_GETARG_INT32(2);
+   int32       n = PG_GETARG_INT32(2);
    NDBOX      *result;
    int         dim = 0;
    int         size;
index 8906397ad23de8edb735f1bb8c68a9b20ec8453d..23c8a6f0e288d1251ef9fb154c057fa86926adcf 100644 (file)
@@ -159,8 +159,8 @@ typedef struct
    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);
index f5c4b71eaff2b8af252c9c5ac6986d55a2919e0c..900118014249df96b69792581ea223e693b81b43 100644 (file)
@@ -40,7 +40,7 @@ typedef char *BITVECP;
 typedef struct
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       flag;
+   int32       flag;
    char        data[1];
 } GISTTYPE;
 
@@ -48,7 +48,7 @@ typedef struct
 
 #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 ) )
@@ -143,7 +143,7 @@ ghstore_compress(PG_FUNCTION_ARGS)
    }
    else if (!ISALLTRUE(DatumGetPointer(entry->key)))
    {
-       int       i;
+       int32       i;
        GISTTYPE   *res;
        BITVECP     sign = GETSIGN(DatumGetPointer(entry->key));
 
@@ -192,7 +192,7 @@ ghstore_same(PG_FUNCTION_ARGS)
        *result = false;
    else
    {
-       int       i;
+       int32       i;
        BITVECP     sa = GETSIGN(a),
                    sb = GETSIGN(b);
 
@@ -209,10 +209,10 @@ ghstore_same(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(result);
 }
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-   int       size = 0,
+   int32       size = 0,
                i;
 
    LOOPBYTE
@@ -253,10 +253,10 @@ hemdist(GISTTYPE *a, GISTTYPE *b)
    return hemdistsign(GETSIGN(a), GETSIGN(b));
 }
 
-static int4
+static int32
 unionkey(BITVECP sbase, GISTTYPE *add)
 {
-   int       i;
+   int32       i;
    BITVECP     sadd = GETSIGN(add);
 
    if (ISALLTRUE(add))
@@ -270,12 +270,12 @@ Datum
 ghstore_union(PG_FUNCTION_ARGS)
 {
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
-   int       len = entryvec->n;
+   int32       len = entryvec->n;
 
    int        *size = (int *) PG_GETARG_POINTER(1);
    BITVEC      base;
-   int       i;
-   int       flag = 0;
+   int32       i;
+   int32       flag = 0;
    GISTTYPE   *result;
 
    MemSet((void *) base, 0, sizeof(BITVEC));
@@ -316,7 +316,7 @@ ghstore_penalty(PG_FUNCTION_ARGS)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -339,11 +339,11 @@ ghstore_picksplit(PG_FUNCTION_ARGS)
               *datum_r;
    BITVECP     union_l,
                union_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
index dde6c4b376ea2a82ed7d3cc0ef040e52f4df393a..aadf050410eb62b61e306fef0e94621ac7d6c2ad 100644 (file)
@@ -36,7 +36,7 @@ typedef struct
 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; \
@@ -74,7 +74,7 @@ get_val(HSParser *state, bool ignoreeq, bool *escaped)
            }
            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) == '\\')
            {
@@ -215,7 +215,7 @@ parse_hstore(HSParser *state)
            }
            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)
@@ -230,7 +230,7 @@ parse_hstore(HSParser *state)
            }
            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)
@@ -263,7 +263,7 @@ parse_hstore(HSParser *state)
            }
            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
@@ -304,7 +304,7 @@ comparePairs(const void *a, const void *b)
  * 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;
@@ -367,14 +367,14 @@ hstoreCheckValLen(size_t len)
 
 
 HStore *
-hstorePairs(Pairs *pairs, int4 pcount, int4 buflen)
+hstorePairs(Pairs *pairs, int32 pcount, int32 buflen)
 {
    HStore     *out;
    HEntry     *entry;
    char       *ptr;
    char       *buf;
-   int       len;
-   int       i;
+   int32       len;
+   int32       i;
 
    len = CALCDATASIZE(pcount, buflen);
    out = palloc(len);
@@ -402,7 +402,7 @@ Datum
 hstore_in(PG_FUNCTION_ARGS)
 {
    HSParser    state;
-   int       buflen;
+   int32       buflen;
    HStore     *out;
 
    state.begin = PG_GETARG_CSTRING(0);
@@ -422,11 +422,11 @@ Datum     hstore_recv(PG_FUNCTION_ARGS);
 Datum
 hstore_recv(PG_FUNCTION_ARGS)
 {
-   int       buflen;
+   int32       buflen;
    HStore     *out;
    Pairs      *pairs;
-   int       i;
-   int       pcount;
+   int32       i;
+   int32       pcount;
    StringInfo  buf = (StringInfo) PG_GETARG_POINTER(0);
 
    pcount = pq_getmsgint(buf, 4);
@@ -518,7 +518,7 @@ Datum       hstore_from_arrays(PG_FUNCTION_ARGS);
 Datum
 hstore_from_arrays(PG_FUNCTION_ARGS)
 {
-   int       buflen;
+   int32       buflen;
    HStore     *out;
    Pairs      *pairs;
    Datum      *key_datums;
@@ -632,7 +632,7 @@ hstore_from_array(PG_FUNCTION_ARGS)
    ArrayType  *in_array = PG_GETARG_ARRAYTYPE_P(0);
    int         ndims = ARR_NDIM(in_array);
    int         count;
-   int       buflen;
+   int32       buflen;
    HStore     *out;
    Pairs      *pairs;
    Datum      *in_datums;
@@ -737,7 +737,7 @@ Datum
 hstore_from_record(PG_FUNCTION_ARGS)
 {
    HeapTupleHeader rec;
-   int       buflen;
+   int32       buflen;
    HStore     *out;
    Pairs      *pairs;
    Oid         tupType;
index 11c069890eafb77f0746a5de11b0fad765f9134d..56aa23cfde0dde19e8fb4142f30b78849bd3424a 100644 (file)
@@ -10,7 +10,7 @@
 #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 */
@@ -71,7 +71,7 @@ typedef char *BITVECP;
 typedef struct
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       flag;
+   int32       flag;
    char        data[1];
 } GISTTYPE;
 
@@ -79,7 +79,7 @@ typedef struct
 
 #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 ) )
@@ -93,7 +93,7 @@ typedef void (*formfloat) (ArrayType *, float *);
 /*
  * 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);
@@ -123,15 +123,15 @@ void      gensign(BITVEC sign, int *a, int len);
  */
 typedef struct ITEM
 {
-   int       type;
-   int       left;
-   int       val;
+   int16       type;
+   int16       left;
+   int32       val;
 } ITEM;
 
 typedef struct QUERYTYPE
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       size;           /* number of ITEMs */
+   int32       size;           /* number of ITEMs */
    ITEM        items[1];       /* variable length array */
 } QUERYTYPE;
 
@@ -167,7 +167,7 @@ int         compDESC(const void *a, const void *b);
    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)
 
index 4e63f6d66c145072984360be989723cd682b9924..dfb113a8ea5f89fe61d85977913b26b20cf7d828 100644 (file)
@@ -34,27 +34,27 @@ Datum       querytree(PG_FUNCTION_ARGS);
  */
 typedef struct NODE
 {
-   int       type;
-   int       val;
+   int32       type;
+   int32       val;
    struct NODE *next;
 } NODE;
 
 typedef struct
 {
    char       *buf;
-   int       state;
-   int       count;
+   int32       state;
+   int32       count;
    /* reverse polish notation in list (for temporary usage) */
    NODE       *str;
    /* number in str */
-   int       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;
@@ -79,7 +79,7 @@ gettoken(WORKSTATE *state, int4 *val)
                else if (*(state->buf) == '!')
                {
                    (state->buf)++;
-                   *val = (int4) '!';
+                   *val = (int32) '!';
                    return OPR;
                }
                else if (*(state->buf) == '(')
@@ -103,7 +103,7 @@ gettoken(WORKSTATE *state, int4 *val)
                    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;
@@ -115,7 +115,7 @@ gettoken(WORKSTATE *state, int4 *val)
                if (*(state->buf) == '&' || *(state->buf) == '|')
                {
                    state->state = WAITOPERAND;
-                   *val = (int4) *(state->buf);
+                   *val = (int32) *(state->buf);
                    (state->buf)++;
                    return OPR;
                }
@@ -143,7 +143,7 @@ gettoken(WORKSTATE *state, int4 *val)
  * 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));
 
@@ -159,13 +159,13 @@ pushquery(WORKSTATE *state, int4 type, int4 val)
 /*
  * make polish notation of query
  */
-static int4
+static int32
 makepol(WORKSTATE *state)
 {
-   int       val,
+   int32       val,
                type;
-   int       stack[STACKDEPTH];
-   int       lenstack = 0;
+   int32       stack[STACKDEPTH];
+   int32       lenstack = 0;
 
    /* since this function recurses, it could be driven to stack overflow */
    check_stack_depth();
@@ -176,15 +176,15 @@ makepol(WORKSTATE *state)
        {
            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
                {
@@ -199,8 +199,8 @@ makepol(WORKSTATE *state)
            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]);
@@ -234,8 +234,8 @@ makepol(WORKSTATE *state)
 
 typedef struct
 {
-   int      *arrb;
-   int      *arre;
+   int32      *arrb;
+   int32      *arre;
 } CHKVAL;
 
 /*
@@ -244,9 +244,9 @@ typedef struct
 static bool
 checkcondition_arr(void *checkval, ITEM *item)
 {
-   int      *StopLow = ((CHKVAL *) checkval)->arrb;
-   int      *StopHigh = ((CHKVAL *) checkval)->arre;
-   int      *StopMiddle;
+   int32      *StopLow = ((CHKVAL *) checkval)->arrb;
+   int32      *StopHigh = ((CHKVAL *) checkval)->arre;
+   int32      *StopMiddle;
 
    /* Loop invariant: StopLow <= val < StopHigh */
 
@@ -281,13 +281,13 @@ execute(ITEM *curitem, void *checkval, bool calcnot,
 
    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);
@@ -379,7 +379,7 @@ contains_required_value(ITEM *curitem)
 
    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
@@ -388,7 +388,7 @@ contains_required_value(ITEM *curitem)
         */
        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))
@@ -449,7 +449,7 @@ boolop(PG_FUNCTION_ARGS)
 }
 
 static void
-findoprnd(ITEM *ptr, int4 *pos)
+findoprnd(ITEM *ptr, int32 *pos)
 {
 #ifdef BS_DEBUG
    elog(DEBUG3, (ptr[*pos].type == OPR) ?
@@ -460,7 +460,7 @@ findoprnd(ITEM *ptr, int4 *pos)
        ptr[*pos].left = 0;
        (*pos)--;
    }
-   else if (ptr[*pos].val == (int4) '!')
+   else if (ptr[*pos].val == (int32) '!')
    {
        ptr[*pos].left = -1;
        (*pos)--;
@@ -469,7 +469,7 @@ findoprnd(ITEM *ptr, int4 *pos)
    else
    {
        ITEM       *curitem = &ptr[*pos];
-       int       tmp = *pos;
+       int32       tmp = *pos;
 
        (*pos)--;
        findoprnd(ptr, pos);
@@ -487,12 +487,12 @@ bqarr_in(PG_FUNCTION_ARGS)
 {
    char       *buf = (char *) PG_GETARG_POINTER(0);
    WORKSTATE   state;
-   int       i;
+   int32       i;
    QUERYTYPE  *query;
-   int       commonlen;
+   int32       commonlen;
    ITEM       *ptr;
    NODE       *tmp;
-   int       pos = 0;
+   int32       pos = 0;
 
 #ifdef BS_DEBUG
    StringInfoData pbuf;
@@ -553,11 +553,11 @@ typedef struct
    ITEM       *curpol;
    char       *buf;
    char       *cur;
-   int       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; \
@@ -573,7 +573,7 @@ infix(INFIX *in, bool first)
        in->cur = strchr(in->cur, '\0');
        in->curpol--;
    }
-   else if (in->curpol->val == (int4) '!')
+   else if (in->curpol->val == (int32) '!')
    {
        bool        isopr = false;
 
@@ -599,11 +599,11 @@ infix(INFIX *in, bool first)
    }
    else
    {
-       int       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, "( ");
@@ -627,7 +627,7 @@ infix(INFIX *in, bool first)
        in->cur = strchr(in->cur, '\0');
        pfree(nrm.buf);
 
-       if (op == (int4) '|' && !first)
+       if (op == (int32) '|' && !first)
        {
            RESIZEBUF(in, 2);
            sprintf(in->cur, " )");
index 9abe54e55f9f4501c2999237e62b06dcaf86ca66..be71e5ce6961b5adb706fdc1b7b54b575919e42f 100644 (file)
@@ -65,7 +65,7 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
        *nentries = ARRNELEMS(query);
        if (*nentries > 0)
        {
-           int      *arr;
+           int32      *arr;
            int32       i;
 
            res = (Datum *) palloc(sizeof(Datum) * (*nentries));
index 0123906be8849aa554c8fa8799c63ecf939c45cb..e429c8b58c95ae91607f5bbadf53321e88cf93dd 100644 (file)
@@ -106,7 +106,7 @@ g_int_union(PG_FUNCTION_ARGS)
 {
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    int        *size = (int *) PG_GETARG_POINTER(1);
-   int       i,
+   int32       i,
               *ptr;
    ArrayType  *res;
    int         totlen = 0;
@@ -128,7 +128,7 @@ g_int_union(PG_FUNCTION_ARGS)
        int         nel;
 
        nel = ARRNELEMS(ent);
-       memcpy(ptr, ARRPTR(ent), nel * sizeof(int4));
+       memcpy(ptr, ARRPTR(ent), nel * sizeof(int32));
        ptr += nel;
    }
 
@@ -317,8 +317,8 @@ g_int_same(PG_FUNCTION_ARGS)
    ArrayType  *a = PG_GETARG_ARRAYTYPE_P(0);
    ArrayType  *b = PG_GETARG_ARRAYTYPE_P(1);
    bool       *result = (bool *) PG_GETARG_POINTER(2);
-   int       n = ARRNELEMS(a);
-   int      *da,
+   int32       n = ARRNELEMS(a);
+   int32      *da,
               *db;
 
    CHECKARRVALID(a);
index 132d15316054d842593468f191eca9053846f706..863557672ee33e612b1a8780f8bb8df1cdbb7a20 100644 (file)
@@ -186,11 +186,11 @@ rt__int_size(ArrayType *a, float *size)
 
 /* Sort the given data (len >= 2). Return true if any duplicates found */
 bool
-isort(int4 *a, int len)
+isort(int32 *a, int len)
 {
-   int       cur,
+   int32       cur,
                prev;
-   int      *pcur,
+   int32      *pcur,
               *pprev,
               *end;
    bool        r = FALSE;
@@ -268,7 +268,7 @@ copy_intArrayType(ArrayType *a)
    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;
 }
 
@@ -389,15 +389,15 @@ int_to_intset(int32 n)
 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;
 }
index c6b00eaeff0da5550b0b6a88da3b49ac1f3926e5..1bad024c099d192b65160ff7d4f5666247692a66 100644 (file)
@@ -81,7 +81,7 @@ static bool
 _intbig_overlap(GISTTYPE *a, ArrayType *b)
 {
    int         num = ARRNELEMS(b);
-   int      *ptr = ARRPTR(b);
+   int32      *ptr = ARRPTR(b);
 
    CHECKARRVALID(b);
 
@@ -99,7 +99,7 @@ static bool
 _intbig_contains(GISTTYPE *a, ArrayType *b)
 {
    int         num = ARRNELEMS(b);
-   int      *ptr = ARRPTR(b);
+   int32      *ptr = ARRPTR(b);
 
    CHECKARRVALID(b);
 
@@ -128,7 +128,7 @@ g_intbig_same(PG_FUNCTION_ARGS)
        *result = false;
    else
    {
-       int       i;
+       int32       i;
        BITVECP     sa = GETSIGN(a),
                    sb = GETSIGN(b);
 
@@ -154,7 +154,7 @@ g_intbig_compress(PG_FUNCTION_ARGS)
    {
        GISTENTRY  *retval;
        ArrayType  *in = DatumGetArrayTypeP(entry->key);
-       int      *ptr;
+       int32      *ptr;
        int         num;
        GISTTYPE   *res = (GISTTYPE *) palloc0(CALCGTSIZE(0));
 
@@ -216,10 +216,10 @@ g_intbig_compress(PG_FUNCTION_ARGS)
 }
 
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-   int       size = 0,
+   int32       size = 0,
                i;
 
    LOOPBYTE
@@ -264,10 +264,10 @@ g_intbig_decompress(PG_FUNCTION_ARGS)
    PG_RETURN_DATUM(PG_GETARG_DATUM(0));
 }
 
-static int4
+static int32
 unionkey(BITVECP sbase, GISTTYPE *add)
 {
-   int       i;
+   int32       i;
    BITVECP     sadd = GETSIGN(add);
 
    if (ISALLTRUE(add))
@@ -283,9 +283,9 @@ g_intbig_union(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    int        *size = (int *) PG_GETARG_POINTER(1);
    BITVEC      base;
-   int       i,
+   int32       i,
                len;
-   int       flag = 0;
+   int32       flag = 0;
    GISTTYPE   *result;
 
    MemSet((void *) base, 0, sizeof(BITVEC));
@@ -326,7 +326,7 @@ g_intbig_penalty(PG_FUNCTION_ARGS)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -347,11 +347,11 @@ g_intbig_picksplit(PG_FUNCTION_ARGS)
               *datum_r;
    BITVECP     union_l,
                union_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
@@ -538,7 +538,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
            {
                int         i,
                            num = ARRNELEMS(query);
-               int      *ptr = ARRPTR(query);
+               int32      *ptr = ARRPTR(query);
                BITVEC      qp;
                BITVECP     dq,
                            de;
@@ -577,7 +577,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
            {
                int         i,
                            num = ARRNELEMS(query);
-               int      *ptr = ARRPTR(query);
+               int32      *ptr = ARRPTR(query);
                BITVEC      qp;
                BITVECP     dq,
                            de;
index 8afc2bd540787a4221a196aa3fff0509d73166f0..93507158c02de047c127af92233c42b4cde366a9 100644 (file)
@@ -83,7 +83,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
    {                           /* ltree */
        ltree_gist *key;
        ArrayType  *val = DatumGetArrayTypeP(entry->key);
-       int       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);
 
@@ -115,7 +115,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
    }
    else if (!LTG_ISALLTRUE(entry->key))
    {
-       int       i,
+       int32       i,
                    len;
        ltree_gist *key;
 
@@ -154,7 +154,7 @@ _ltree_same(PG_FUNCTION_ARGS)
        *result = false;
    else
    {
-       int       i;
+       int32       i;
        BITVECP     sa = LTG_SIGN(a),
                    sb = LTG_SIGN(b);
 
@@ -171,10 +171,10 @@ _ltree_same(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(result);
 }
 
-static int4
+static int32
 unionkey(BITVECP sbase, ltree_gist *add)
 {
-   int       i;
+   int32       i;
    BITVECP     sadd = LTG_SIGN(add);
 
    if (LTG_ISALLTRUE(add))
@@ -191,9 +191,9 @@ _ltree_union(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    int        *size = (int *) PG_GETARG_POINTER(1);
    ABITVEC     base;
-   int       i,
+   int32       i,
                len;
-   int       flag = 0;
+   int32       flag = 0;
    ltree_gist *result;
 
    MemSet((void *) base, 0, sizeof(ABITVEC));
@@ -217,10 +217,10 @@ _ltree_union(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(result);
 }
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-   int       size = 0,
+   int32       size = 0,
                i;
 
    ALOOPBYTE
@@ -274,7 +274,7 @@ _ltree_penalty(PG_FUNCTION_ARGS)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -294,11 +294,11 @@ _ltree_picksplit(PG_FUNCTION_ARGS)
               *datum_r;
    BITVECP     union_l,
                union_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
index aec445847f9a5730d70252e77b4d86a5693d4c62..563970a67a457c1c3d4ffa2f3aa93359fed188e3 100644 (file)
@@ -30,7 +30,7 @@ typedef struct
 
 typedef struct
 {
-   int       val;
+   int32       val;
    uint16      len;
    uint8       flag;
    char        name[1];
@@ -89,9 +89,9 @@ typedef struct
  */
 typedef struct ITEM
 {
-   int       type;
-   int       left;
-   int       val;
+   int16       type;
+   int16       left;
+   int32       val;
    uint8       flag;
    /* user-friendly value */
    uint8       length;
@@ -105,11 +105,11 @@ typedef struct ITEM
 typedef struct
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       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) )
@@ -173,7 +173,7 @@ int         ltree_strncasecmp(const char *a, const char *b, size_t s);
 
 #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;
@@ -229,7 +229,7 @@ typedef struct
 /* 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];
 
index 13d96656d2e146d05855133e3ea7198234f2e23e..5324c65f59ef86be0bad50f24104cbb0e2e0c102 100644 (file)
@@ -70,7 +70,7 @@ ltree_compress(PG_FUNCTION_ARGS)
    {                           /* ltree */
        ltree_gist *key;
        ltree      *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
-       int       len = LTG_HDRSIZE + VARSIZE(val);
+       int32       len = LTG_HDRSIZE + VARSIZE(val);
 
        key = (ltree_gist *) palloc(len);
        SET_VARSIZE(key, len);
@@ -118,7 +118,7 @@ ltree_same(PG_FUNCTION_ARGS)
        *result = (ISEQ(LTG_NODE(a), LTG_NODE(b))) ? true : false;
    else
    {
-       int       i;
+       int32       i;
        BITVECP     sa = LTG_SIGN(a),
                    sb = LTG_SIGN(b);
 
@@ -169,7 +169,7 @@ ltree_union(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    int        *size = (int *) PG_GETARG_POINTER(1);
    BITVEC      base;
-   int       i,
+   int32       i,
                j;
    ltree_gist *result,
               *cur;
@@ -253,7 +253,7 @@ ltree_penalty(PG_FUNCTION_ARGS)
    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);
-   int       cmpr,
+   int32       cmpr,
                cmpl;
 
    cmpl = ltree_compare(LTG_GETLNODE(origval), LTG_GETLNODE(newval));
@@ -287,7 +287,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
    OffsetNumber j;
-   int       i;
+   int32       i;
    RIX        *array;
    OffsetNumber maxoff;
    int         nbytes;
@@ -441,7 +441,7 @@ ltree_picksplit(PG_FUNCTION_ARGS)
 static bool
 gist_isparent(ltree_gist *key, ltree *query)
 {
-   int       numlevel = query->numlevel;
+   int32       numlevel = query->numlevel;
    int         i;
 
    for (i = query->numlevel; i >= 0; i--)
index 4290ad4e63b3db6d3b101e196e826234410fa386..4d8fb842c14fedcfab04e5db5db6693b2a217ee0 100644 (file)
@@ -200,7 +200,7 @@ ltree_risparent(PG_FUNCTION_ARGS)
 
 
 static ltree *
-inner_subltree(ltree *t, int4 startpos, int4 endpos)
+inner_subltree(ltree *t, int32 startpos, int32 endpos)
 {
    char       *start = NULL,
               *end = NULL;
@@ -252,9 +252,9 @@ Datum
 subpath(PG_FUNCTION_ARGS)
 {
    ltree      *t = PG_GETARG_LTREE(0);
-   int       start = PG_GETARG_INT32(1);
-   int       len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
-   int       end;
+   int32       start = PG_GETARG_INT32(1);
+   int32       len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
+   int32       end;
    ltree      *res;
 
    end = start + len;
index 826f4e1c9ddcf0120862565786745148abd61732..c2e532c3b819da76997b34c332d6dad234e3fd0e 100644 (file)
@@ -28,10 +28,10 @@ Datum       ltxtq_out(PG_FUNCTION_ARGS);
  */
 typedef struct NODE
 {
-   int       type;
-   int       val;
-   int       distance;
-   int       length;
+   int32       type;
+   int32       val;
+   int16       distance;
+   int16       length;
    uint16      flag;
    struct NODE *next;
 } NODE;
@@ -39,16 +39,16 @@ typedef struct NODE
 typedef struct
 {
    char       *buf;
-   int       state;
-   int       count;
+   int32       state;
+   int32       count;
    /* reverse polish notation in list (for temporary usage) */
    NODE       *str;
    /* number in str */
-   int       num;
+   int32       num;
 
    /* user-friendly operand */
-   int       lenop;
-   int       sumlen;
+   int32       lenop;
+   int32       sumlen;
    char       *op;
    char       *curop;
 } QPRS_STATE;
@@ -56,8 +56,8 @@ typedef struct
 /*
  * 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;
 
@@ -71,7 +71,7 @@ gettoken_query(QPRS_STATE *state, int4 *val, int4 *lenval, char **strval, uint16
                if (charlen == 1 && t_iseq(state->buf, '!'))
                {
                    (state->buf)++;
-                   *val = (int4) '!';
+                   *val = (int32) '!';
                    return OPR;
                }
                else if (charlen == 1 && t_iseq(state->buf, '('))
@@ -117,7 +117,7 @@ gettoken_query(QPRS_STATE *state, int4 *val, int4 *lenval, char **strval, uint16
                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;
                }
@@ -146,7 +146,7 @@ gettoken_query(QPRS_STATE *state, int4 *val, int4 *lenval, char **strval, uint16
  * 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));
 
@@ -184,7 +184,7 @@ pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)
 
    while (state->curop - state->op + lenval + 1 >= state->lenop)
    {
-       int       tmp = state->curop - state->op;
+       int32       tmp = state->curop - state->op;
 
        state->lenop *= 2;
        state->op = (char *) repalloc((void *) state->op, state->lenop);
@@ -202,15 +202,15 @@ pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag)
 /*
  * make polish notaion of query
  */
-static int4
+static int32
 makepol(QPRS_STATE *state)
 {
-   int       val = 0,
+   int32       val = 0,
                type;
-   int       lenval = 0;
+   int32       lenval = 0;
    char       *strval = NULL;
-   int       stack[STACKDEPTH];
-   int       lenstack = 0;
+   int32       stack[STACKDEPTH];
+   int32       lenstack = 0;
    uint16      flag = 0;
 
    while ((type = gettoken_query(state, &val, &lenval, &strval, &flag)) != END)
@@ -219,15 +219,15 @@ makepol(QPRS_STATE *state)
        {
            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
                {
@@ -241,8 +241,8 @@ makepol(QPRS_STATE *state)
            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);
@@ -275,14 +275,14 @@ makepol(QPRS_STATE *state)
 }
 
 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)++;
@@ -291,7 +291,7 @@ findoprnd(ITEM *ptr, int4 *pos)
    else
    {
        ITEM       *curitem = &ptr[*pos];
-       int       tmp = *pos;
+       int32       tmp = *pos;
 
        (*pos)++;
        findoprnd(ptr, pos);
@@ -308,12 +308,12 @@ static ltxtquery *
 queryin(char *buf)
 {
    QPRS_STATE  state;
-   int       i;
+   int32       i;
    ltxtquery  *query;
-   int       commonlen;
+   int32       commonlen;
    ITEM       *ptr;
    NODE       *tmp;
-   int       pos = 0;
+   int32       pos = 0;
 
 #ifdef BS_DEBUG
    char        pbuf[16384],
@@ -390,13 +390,13 @@ typedef struct
    char       *buf;
    char       *cur;
    char       *op;
-   int       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; \
@@ -438,7 +438,7 @@ infix(INFIX *in, bool first)
        *(in->cur) = '\0';
        in->curpol++;
    }
-   else if (in->curpol->val == (int4) '!')
+   else if (in->curpol->val == (int32) '!')
    {
        bool        isopr = false;
 
@@ -464,11 +464,11 @@ infix(INFIX *in, bool first)
    }
    else
    {
-       int       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, "( ");
@@ -493,7 +493,7 @@ infix(INFIX *in, bool first)
        in->cur = strchr(in->cur, '\0');
        pfree(nrm.buf);
 
-       if (op == (int4) '|' && !first)
+       if (op == (int32) '|' && !first)
        {
            RESIZEBUF(in, 2);
            sprintf(in->cur, " )");
index 1c13888605833645d0d1797fcefa06e98fbd23e4..bedbe247eb8b0143f803dfc7b6e0cba6f1e2a735 100644 (file)
@@ -20,13 +20,13 @@ ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void
 {
    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);
index d59c8eb670b44c4c8b79e6b92baa0f68e6ce4e73..605d7ea3569a5a40733cce6e486bb39fd2c5d865 100644 (file)
@@ -78,10 +78,10 @@ gtrgm_out(PG_FUNCTION_ARGS)
 static void
 makesign(BITVECP sign, TRGM *a)
 {
-   int       k,
+   int32       k,
                len = ARRNELEM(a);
    trgm       *ptr = GETARR(a);
-   int       tmp = 0;
+   int32       tmp = 0;
 
    MemSet((void *) sign, 0, sizeof(BITVEC));
    SETBIT(sign, SIGLENBIT);    /* set last unused bit */
@@ -112,7 +112,7 @@ gtrgm_compress(PG_FUNCTION_ARGS)
    else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
             !ISALLTRUE(DatumGetPointer(entry->key)))
    {
-       int       i,
+       int32       i,
                    len;
        TRGM       *res;
        BITVECP     sign = GETSIGN(DatumGetPointer(entry->key));
@@ -160,14 +160,14 @@ gtrgm_decompress(PG_FUNCTION_ARGS)
    }
 }
 
-static int4
+static int32
 cnt_sml_sign_common(TRGM *qtrg, BITVECP sign)
 {
-   int       count = 0;
-   int       k,
+   int32       count = 0;
+   int32       k,
                len = ARRNELEM(qtrg);
    trgm       *ptr = GETARR(qtrg);
-   int       tmp = 0;
+   int32       tmp = 0;
 
    for (k = 0; k < len; k++)
    {
@@ -267,8 +267,8 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
            }
            else
            {                   /* non-leaf contains signature */
-               int       count = cnt_sml_sign_common(qtrg, GETSIGN(key));
-               int       len = ARRNELEM(qtrg);
+               int32       count = cnt_sml_sign_common(qtrg, GETSIGN(key));
+               int32       len = ARRNELEM(qtrg);
 
                if (len == 0)
                    res = false;
@@ -379,8 +379,8 @@ gtrgm_distance(PG_FUNCTION_ARGS)
            }
            else
            {                   /* non-leaf contains signature */
-               int       count = cnt_sml_sign_common(qtrg, GETSIGN(key));
-               int       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);
            }
@@ -394,10 +394,10 @@ gtrgm_distance(PG_FUNCTION_ARGS)
    PG_RETURN_FLOAT8(res);
 }
 
-static int4
+static int32
 unionkey(BITVECP sbase, TRGM *add)
 {
-   int       i;
+   int32       i;
 
    if (ISSIGNKEY(add))
    {
@@ -412,7 +412,7 @@ unionkey(BITVECP sbase, TRGM *add)
    else
    {
        trgm       *ptr = GETARR(add);
-       int       tmp = 0;
+       int32       tmp = 0;
 
        for (i = 0; i < ARRNELEM(add); i++)
        {
@@ -428,11 +428,11 @@ Datum
 gtrgm_union(PG_FUNCTION_ARGS)
 {
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
-   int       len = entryvec->n;
+   int32       len = entryvec->n;
    int        *size = (int *) PG_GETARG_POINTER(1);
    BITVEC      base;
-   int       i;
-   int       flag = 0;
+   int32       i;
+   int32       flag = 0;
    TRGM       *result;
 
    MemSet((void *) base, 0, sizeof(BITVEC));
@@ -474,7 +474,7 @@ gtrgm_same(PG_FUNCTION_ARGS)
            *result = false;
        else
        {
-           int       i;
+           int32       i;
            BITVECP     sa = GETSIGN(a),
                        sb = GETSIGN(b);
 
@@ -491,7 +491,7 @@ gtrgm_same(PG_FUNCTION_ARGS)
    }
    else
    {                           /* a and b ISARRKEY */
-       int       lena = ARRNELEM(a),
+       int32       lena = ARRNELEM(a),
                    lenb = ARRNELEM(b);
 
        if (lena != lenb)
@@ -500,7 +500,7 @@ gtrgm_same(PG_FUNCTION_ARGS)
        {
            trgm       *ptra = GETARR(a),
                       *ptrb = GETARR(b);
-           int       i;
+           int32       i;
 
            *result = true;
            for (i = 0; i < lena; i++)
@@ -515,10 +515,10 @@ gtrgm_same(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(result);
 }
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-   int       size = 0,
+   int32       size = 0,
                i;
 
    LOOPBYTE
@@ -634,7 +634,7 @@ fillcache(CACHESIGN *item, TRGM *key)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -675,11 +675,11 @@ gtrgm_picksplit(PG_FUNCTION_ARGS)
               *datum_r;
    BITVECP     union_l,
                union_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
index e2b10703ee96cf4abcbfd133b0327c5060a932a2..7b2d2b0ad39944ff0f8f567b889a0f26dd3aeffc 100644 (file)
@@ -1739,6 +1739,13 @@ PG_MODULE_MAGIC;
 /* 4-byte integer, passed by value */
 typedef int int4;
 
+
+     (The actual PostgreSQL C code calls this type int32, because
+     it is a convention in C that intXX
+     means XX bits.  Note
+     therefore also that the C type int8 is 1 byte in size.  The
+     SQL type int8 is called int64 in C.  See also
+     .)
     
 
     
@@ -1801,7 +1808,7 @@ typedef struct
 
 
 typedef struct {
-    int4 length;
+    int32 length;
     char data[1];
 } text;
 
@@ -1913,7 +1920,7 @@ memcpy(destination->data, buffer, 40);
         
         
          smallint (int2)
-         int2 or int16
+         int16
          postgres.h
         
         
@@ -1923,7 +1930,7 @@ memcpy(destination->data, buffer, 40);
         
         
          integer (int4)
-         int4 or int32
+         int32
          postgres.h
         
         
index 0e4cf8e0a3e2d1b9ce7d2162896d4bdf0cf19505..033674652db336c6ad9b38e1e73a1111cf2311d9 100644 (file)
@@ -135,7 +135,7 @@ hashint2vector(PG_FUNCTION_ARGS)
 {
    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
index 5da265025e6192cfc7ea397595c5dac820b42dd5..e8fdc4990badc40428f7cd5c57b7ead895e34e64 100644 (file)
@@ -50,7 +50,7 @@ spg_quad_config(PG_FUNCTION_ARGS)
  * 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) ||
index cdb0bee1305b269bbc01b274889bf0fc95cf9789..0be29e304e630a08f3a8ffc164225a027cc1a1d6 100644 (file)
@@ -31,6 +31,8 @@ sub Catalogs
     # 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'
index 1b6bb3bb6d7e02c065b3950bf83a715341aa8110..20850ab034a6633399b57b4339a186470f282c1c 100644 (file)
@@ -3332,7 +3332,7 @@ get_conversion_oid(List *name, bool missing_ok)
  * 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;
index 5b2ad6bfe0d41d1bf60e2df0aa7cb905e4be0896..6062926e6049736b605c62a4d3761603c04bfc91 100644 (file)
@@ -91,7 +91,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
    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);
index a72b0ad5ff24bd50b04bb576cb3e1ba0b897ae67..cfec413d54fbc94433d559390b96f349cf1df95b 100644 (file)
@@ -1204,9 +1204,9 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
 
    /* swap size statistics too, since new rel has freshly-updated stats */
    {
-       int       swap_pages;
+       int32       swap_pages;
        float4      swap_tuples;
-       int       swap_allvisible;
+       int32       swap_allvisible;
 
        swap_pages = relform1->relpages;
        relform1->relpages = relform2->relpages;
index 834b694ec6b872081855f009a3919ea2ab5c1b8a..faa7f0c4c5032fd8771b95ca45731d1102e38633 100644 (file)
@@ -121,7 +121,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
 {
    int16       tgtype;
    int         ncolumns;
-   int      *columns;
+   int16      *columns;
    int2vector *tgattr;
    Node       *whenClause;
    List       *whenRtable;
@@ -589,11 +589,11 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
        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));
-           int       attnum;
+           int16       attnum;
            int         j;
 
            /* Lookup column name.  System columns are not allowed */
@@ -1501,9 +1501,9 @@ RelationBuildTriggers(Relation relation)
        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;
@@ -1654,11 +1654,11 @@ CopyTriggerDesc(TriggerDesc *trigdesc)
        trigger->tgname = pstrdup(trigger->tgname);
        if (trigger->tgnattr > 0)
        {
-           int      *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)
@@ -1772,7 +1772,7 @@ equalTriggerDescs(TriggerDesc *trigdesc1, TriggerDesc *trigdesc2)
                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)
index 6475633ae7d06756ab9528a5b6323dd9cd3debb7..8ee6cf7f0e055a6076ae9b6b2128f03054211224 100644 (file)
@@ -987,7 +987,7 @@ generate_setop_tlist(List *colTypes, List *colCollations,
        expr = (Node *) makeConst(INT4OID,
                                  -1,
                                  InvalidOid,
-                                 sizeof(int4),
+                                 sizeof(int32),
                                  Int32GetDatum(flag),
                                  false,
                                  true);
index 8810d0dbad5d942855449ea2da8b47a4b317692e..adc0d5b775e9754941d880722ea2fb7f4bf704fd 100644 (file)
@@ -1578,7 +1578,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
 
        for (i = 0; i < index_form->indnatts; i++)
        {
-           int       attnum = index_form->indkey.values[i];
+           int16       attnum = index_form->indkey.values[i];
            Form_pg_attribute attform;
            char       *attname;
            Oid         defopclass;
index bb886ee5849fb52246f7a1de94a1c79c057f5e11..7a4fa93ee75c37162d5eb830b0fd96b3975447f0 100644 (file)
@@ -49,7 +49,7 @@ compareWORD(const void *a, const void *b)
 }
 
 static int
-uniqueWORD(ParsedWord *a, int4 l)
+uniqueWORD(ParsedWord *a, int32 l)
 {
    ParsedWord *ptr,
               *res;
@@ -265,9 +265,9 @@ to_tsvector(PG_FUNCTION_ARGS)
  * 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)
 {
-   int       count = 0;
+   int32       count = 0;
    ParsedText  prs;
    uint32      variant,
                pos,
@@ -333,7 +333,7 @@ to_tsquery_byid(PG_FUNCTION_ARGS)
    text       *in = PG_GETARG_TEXT_P(1);
    TSQuery     query;
    QueryItem  *res;
-   int       len;
+   int32       len;
 
    query = parse_tsquery(text_to_cstring(in), pushval_morph, ObjectIdGetDatum(cfgid), false);
 
@@ -357,7 +357,7 @@ to_tsquery_byid(PG_FUNCTION_ARGS)
    if (len != query->size)
    {
        char       *oldoperand = GETOPERAND(query);
-       int       lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
+       int32       lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
 
        Assert(len < query->size);
 
@@ -389,7 +389,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
    text       *in = PG_GETARG_TEXT_P(1);
    TSQuery     query;
    QueryItem  *res;
-   int       len;
+   int32       len;
 
    query = parse_tsquery(text_to_cstring(in), pushval_morph, ObjectIdGetDatum(cfgid), true);
 
@@ -408,7 +408,7 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
    if (len != query->size)
    {
        char       *oldoperand = GETOPERAND(query);
-       int       lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
+       int32       lenoperand = VARSIZE(query) - (oldoperand - (char *) query);
 
        Assert(len < query->size);
 
index 805fa25d5ee9a0731566ece9227b9093e46f2854..ae59c34938c18dfc152a833e04a1e39d08ab23af 100644 (file)
@@ -592,7 +592,7 @@ generateHeadline(HeadlineParsedText *prs)
    char       *ptr;
    int         len = 128;
    int         numfragments = 0;
-   int       infrag = 0;
+   int16       infrag = 0;
 
    HeadlineWordEntry *wrd = prs->words;
 
index f2ec784ac231e0a9b309b600cb4428bd6351f392..56763412f3b4f5e2997b4f172e039a060c8dbb52 100644 (file)
@@ -2133,12 +2133,12 @@ mark_fragment(HeadlineParsedText *prs, int highlight, int startpos, int endpos)
 
 typedef struct
 {
-   int       startpos;
-   int       endpos;
-   int       poslen;
-   int       curlen;
-   int       in;
-   int       excluded;
+   int32       startpos;
+   int32       endpos;
+   int32       poslen;
+   int32       curlen;
+   int16       in;
+   int16       excluded;
 } CoverPos;
 
 static void
@@ -2191,24 +2191,24 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, int highlight,
                  int shortword, int min_words,
                  int max_words, int max_fragments)
 {
-   int       poslen,
+   int32       poslen,
                curlen,
                i,
                f,
                num_f = 0;
-   int       stretch,
+   int32       stretch,
                maxstretch,
                posmarker;
 
-   int       startpos = 0,
+   int32       startpos = 0,
                endpos = 0,
                p = 0,
                q = 0;
 
-   int       numcovers = 0,
+   int32       numcovers = 0,
                maxcovers = 32;
 
-   int       minI,
+   int32       minI,
                minwords,
                maxitems;
    CoverPos   *covers;
index 5582a06c7f24ca9cd545d63e40120b2a67e6b499..c221c20c9f6519abb500426e444524190f22b18a 100644 (file)
@@ -4713,8 +4713,8 @@ array_smaller(PG_FUNCTION_ARGS)
 
 typedef struct generate_subscripts_fctx
 {
-   int       lower;
-   int       upper;
+   int32       lower;
+   int32       upper;
    bool        reverse;
 } generate_subscripts_fctx;
 
index a339abf17b6f84229ef2fee38e0e4a234e7a2f81..4be39014495fe2c4bfe9da79128e62db6ae0fbb5 100644 (file)
@@ -40,7 +40,7 @@
 
 #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
 {
@@ -109,14 +109,14 @@ int2send(PG_FUNCTION_ARGS)
  * 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
@@ -266,7 +266,7 @@ int2vectoreq(PG_FUNCTION_ARGS)
 
    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);
 }
 
 
index 5bf3533a114d136389d3e2fc5ead23b4d6d2bc8d..ec93149f3e7987b8caf5f1b4fe38b66802ed258b 100644 (file)
@@ -2394,7 +2394,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
    char       *rulename;
    char        ev_type;
    Oid         ev_class;
-   int       ev_attr;
+   int16       ev_attr;
    bool        is_instead;
    char       *ev_qual;
    char       *ev_action;
@@ -2584,7 +2584,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
    Query      *query;
    char        ev_type;
    Oid         ev_class;
-   int       ev_attr;
+   int16       ev_attr;
    bool        is_instead;
    char       *ev_qual;
    char       *ev_action;
@@ -2603,7 +2603,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
    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);
index 8900c0f497849f0dcdd9f03d441945678dff987a..8b045c6e739697773af0ea5cd9a46e57d42a3d48 100644 (file)
@@ -109,7 +109,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS)
    if (query->size > 0)
    {
        QueryItem  *item = GETQUERY(query);
-       int       i,
+       int32       i,
                    j;
        bool       *partialmatch;
        int        *map_item_operand;
index 674e48c871dc8f5b4f262374024bfdb9600c6d74..dd8164b9dfe5bee8332c36d0168613fe0319400c 100644 (file)
@@ -22,7 +22,7 @@
 #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];
@@ -49,7 +49,7 @@ typedef char *BITVECP;
 typedef struct
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       flag;
+   int32       flag;
    char        data[1];
 } SignTSVector;
 
@@ -61,12 +61,12 @@ typedef struct
 #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] = {
@@ -88,7 +88,7 @@ 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)
@@ -131,8 +131,8 @@ gtsvectorout(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;
@@ -140,13 +140,13 @@ compareint(const void *va, const void *vb)
 }
 
 /*
- * 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)
 {
-   int      *ptr,
+   int32      *ptr,
               *res;
 
    if (l <= 1)
@@ -154,7 +154,7 @@ uniqueint(int4 *a, int4 l)
 
    ptr = res = a;
 
-   qsort((void *) a, l, sizeof(int4), compareint);
+   qsort((void *) a, l, sizeof(int32), compareint);
 
    while (ptr - a < l)
        if (*ptr != *res)
@@ -167,9 +167,9 @@ uniqueint(int4 *a, int4 l)
 static void
 makesign(BITVECP sign, SignTSVector *a)
 {
-   int       k,
+   int32       k,
                len = ARRNELEM(a);
-   int      *ptr = GETARR(a);
+   int32      *ptr = GETARR(a);
 
    MemSet((void *) sign, 0, sizeof(BITVEC));
    for (k = 0; k < len; k++)
@@ -186,8 +186,8 @@ gtsvector_compress(PG_FUNCTION_ARGS)
    {                           /* tsvector */
        SignTSVector *res;
        TSVector    val = DatumGetTSVector(entry->key);
-       int       len;
-       int      *arr;
+       int32       len;
+       int32      *arr;
        WordEntry  *ptr = ARRPTR(val);
        char       *words = STRPTR(val);
 
@@ -205,7 +205,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
            COMP_CRC32(c, words + ptr->pos, ptr->len);
            FIN_CRC32(c);
 
-           *arr = *(int4 *) &c;
+           *arr = *(int32 *) &c;
            arr++;
            ptr++;
        }
@@ -243,7 +243,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
    else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
             !ISALLTRUE(DatumGetPointer(entry->key)))
    {
-       int       i,
+       int32       i,
                    len;
        SignTSVector *res;
        BITVECP     sign = GETSIGN(DatumGetPointer(entry->key));
@@ -289,8 +289,8 @@ gtsvector_decompress(PG_FUNCTION_ARGS)
 
 typedef struct
 {
-   int      *arrb;
-   int      *arre;
+   int32      *arrb;
+   int32      *arre;
 } CHKVAL;
 
 /*
@@ -299,9 +299,9 @@ typedef struct
 static bool
 checkcondition_arr(void *checkval, QueryOperand *val)
 {
-   int      *StopLow = ((CHKVAL *) checkval)->arrb;
-   int      *StopHigh = ((CHKVAL *) checkval)->arre;
-   int      *StopMiddle;
+   int32      *StopLow = ((CHKVAL *) checkval)->arrb;
+   int32      *StopHigh = ((CHKVAL *) checkval)->arre;
+   int32      *StopMiddle;
 
    /* Loop invariant: StopLow <= val < StopHigh */
 
@@ -378,10 +378,10 @@ gtsvector_consistent(PG_FUNCTION_ARGS)
    }
 }
 
-static int4
+static int32
 unionkey(BITVECP sbase, SignTSVector *add)
 {
-   int       i;
+   int32       i;
 
    if (ISSIGNKEY(add))
    {
@@ -395,7 +395,7 @@ unionkey(BITVECP sbase, SignTSVector *add)
    }
    else
    {
-       int      *ptr = GETARR(add);
+       int32      *ptr = GETARR(add);
 
        for (i = 0; i < ARRNELEM(add); i++)
            HASH(sbase, ptr[i]);
@@ -410,9 +410,9 @@ gtsvector_union(PG_FUNCTION_ARGS)
    GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
    int        *size = (int *) PG_GETARG_POINTER(1);
    BITVEC      base;
-   int       i,
+   int32       i,
                len;
-   int       flag = 0;
+   int32       flag = 0;
    SignTSVector *result;
 
    MemSet((void *) base, 0, sizeof(BITVEC));
@@ -454,7 +454,7 @@ gtsvector_same(PG_FUNCTION_ARGS)
            *result = false;
        else
        {
-           int       i;
+           int32       i;
            BITVECP     sa = GETSIGN(a),
                        sb = GETSIGN(b);
 
@@ -471,16 +471,16 @@ gtsvector_same(PG_FUNCTION_ARGS)
    }
    else
    {                           /* a and b ISARRKEY */
-       int       lena = ARRNELEM(a),
+       int32       lena = ARRNELEM(a),
                    lenb = ARRNELEM(b);
 
        if (lena != lenb)
            *result = false;
        else
        {
-           int      *ptra = GETARR(a),
+           int32      *ptra = GETARR(a),
                       *ptrb = GETARR(b);
-           int       i;
+           int32       i;
 
            *result = true;
            for (i = 0; i < lena; i++)
@@ -495,10 +495,10 @@ gtsvector_same(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(result);
 }
 
-static int4
+static int32
 sizebitvec(BITVECP sign)
 {
-   int       size = 0,
+   int32       size = 0,
                i;
 
    LOOPBYTE
@@ -587,7 +587,7 @@ fillcache(CACHESIGN *item, SignTSVector *key)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -630,11 +630,11 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
               *datum_r;
    BITVECP     union_l,
                union_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
index 6e1f8cfdb0deb34e826f0ac8d0a71f4c10324931..010167a8a923b8228f0a18d08694c417f0ef3bf6 100644 (file)
@@ -271,7 +271,7 @@ pushValue_internal(TSQueryParserState state, pg_crc32 valcrc, int distance, int
  * 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;
 
index 74e40246c429c0ba226fc0f235bf9fbac3abe879..f76f9fb54e353b582aa0c8964519673f05cb9ccc 100644 (file)
@@ -150,7 +150,7 @@ gtsquery_penalty(PG_FUNCTION_ARGS)
 typedef struct
 {
    OffsetNumber pos;
-   int       cost;
+   int32       cost;
 } SPLITCOST;
 
 static int
@@ -174,11 +174,11 @@ gtsquery_picksplit(PG_FUNCTION_ARGS)
                j;
    TSQuerySign datum_l,
                datum_r;
-   int       size_alpha,
+   int32       size_alpha,
                size_beta;
-   int       size_waste,
+   int32       size_waste,
                waste = -1;
-   int       nbytes;
+   int32       nbytes;
    OffsetNumber seed_1 = 0,
                seed_2 = 0;
    OffsetNumber *left,
index a45caf05af57ac655779470a51559df99bc54870..acda098db1ae6d6d9173e8f5e287cc22eec2e7e4 100644 (file)
@@ -40,7 +40,7 @@ static float calc_rank_and(float *w, TSVector t, TSQuery q);
  * Returns a weight of a word collocation
  */
 static float4
-word_distance(int4 w)
+word_distance(int32 w)
 {
    if (w > 100)
        return 1e-30f;
@@ -213,7 +213,7 @@ calc_rank_and(float *w, TSVector t, TSQuery q)
               *firstentry;
    WordEntryPos *post,
               *ct;
-   int       dimt,
+   int32       dimt,
                lenct,
                dist,
                nitem;
@@ -283,7 +283,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q)
    WordEntry  *entry,
               *firstentry;
    WordEntryPos *post;
-   int       dimt,
+   int32       dimt,
                j,
                i,
                nitem;
@@ -297,7 +297,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q)
    {
        float       resj,
                    wjm;
-       int       jm;
+       int32       jm;
 
        firstentry = entry = find_wordentry(t, q, item[i], &nitem);
        if (!entry)
@@ -347,7 +347,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q)
 }
 
 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;
@@ -621,7 +621,7 @@ get_docrep(TSVector txt, QueryRepresentation *qr, int *doclen)
    WordEntry  *entry,
               *firstentry;
    WordEntryPos *post;
-   int       dimt,
+   int32       dimt,
                j,
                i,
                nitem;
index 8a81f3d8295f85bb9e36898d0ea326a171549890..688e3652c72471f2c03438c2228ee3933570e9de 100644 (file)
@@ -309,7 +309,7 @@ tsvectorout(PG_FUNCTION_ARGS)
 {
    TSVector    out = PG_GETARG_TSVECTOR(0);
    char       *outbuf;
-   int       i,
+   int32       i,
                lenbuf = 0,
                pp;
    WordEntry  *ptr = ARRPTR(out);
index eb5c45b3d81480e7ea56ca7eded8811e7018c477..34be330522cb6fe11ea92dc28ce09678325332a1 100644 (file)
@@ -51,7 +51,7 @@ typedef struct StatEntry
 
 typedef struct
 {
-   int       weight;
+   int32       weight;
 
    uint32      maxdepth;
 
@@ -221,7 +221,7 @@ Datum
 tsvector_length(PG_FUNCTION_ARGS)
 {
    TSVector    in = PG_GETARG_TSVECTOR(0);
-   int       ret = in->size;
+   int32       ret = in->size;
 
    PG_FREE_IF_COPY(in, 0);
    PG_RETURN_INT32(ret);
@@ -293,10 +293,10 @@ tsvector_setweight(PG_FUNCTION_ARGS)
  * 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;
@@ -552,7 +552,7 @@ tsvector_concat(PG_FUNCTION_ARGS)
  *
  * 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;
index e56a92358c75b564347499f6b72c8b6806a2a007..32f23ad6f5b13e215b770cc1f982505ebdccb515 100644 (file)
@@ -195,7 +195,7 @@ typedef signed char GinNullCategory;
  */
 #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) \
index 8b3c5e59967af894478cb28006af8f7b526a00aa..50e1ecfde4da66899eb294f9b51a8b49bc7c297e 100644 (file)
@@ -329,8 +329,6 @@ typedef signed int Offset;
 /*
  * Common Postgres datatype names (as used in the catalogs)
  */
-typedef int16 int2;
-typedef int32 int4;
 typedef float float4;
 typedef double float8;
 
@@ -424,7 +422,7 @@ typedef struct
    Oid         elemtype;
    int         dim1;
    int         lbound1;
-   int       values[1];      /* VARIABLE LENGTH ARRAY */
+   int16       values[1];      /* VARIABLE LENGTH ARRAY */
 } int2vector;                  /* VARIABLE LENGTH STRUCT */
 
 typedef struct
index 76215dc8a1e7534d879d9f407378f1c1e75428f0..2b633345a8838af940f7e793a9e1e19b9cd12f07 100644 (file)
@@ -133,7 +133,7 @@ extern void PopOverrideSearchPath(void);
 
 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);
index 0d7ed6857e832c0dd4a02bef4a5e2c9dfaa39124..77570c055f5605c8c2f2782be38c6176647fdc80 100644 (file)
 CATALOG(pg_am,2601)
 {
    NameData    amname;         /* access method name */
-   int       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. */
-   int       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? */
index 82391b09d8d5bd152e0f7f79f08b92408c828aea..ee6ac8fb69809a46770c81e2f3ce14e6293e1655 100644 (file)
@@ -58,7 +58,7 @@ CATALOG(pg_amop,2602)
    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 */
-   int       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 */
index 72307dec2206b33c1f211db49b172fbb50ad2cea..99d4676a5de11af6a0a372b34c6ba3b59a08d6e7 100644 (file)
@@ -47,7 +47,7 @@ CATALOG(pg_amproc,2603)
    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 */
-   int       amprocnum;      /* support procedure index */
+   int16       amprocnum;      /* support procedure index */
    regproc     amproc;         /* OID of the proc */
 } FormData_pg_amproc;
 
index b92fd1593f9adb7815b5777fb4fd1e84fcf964b9..6c6366bb2f49f5f7b6729759c32ae716239f55aa 100644 (file)
@@ -31,7 +31,7 @@
 CATALOG(pg_attrdef,2604)
 {
    Oid         adrelid;        /* OID of table containing attribute */
-   int       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 */
index 4ee1d90ce324ed06b5082811e47d4fccb663be9e..3c4d9e2062837fc61d4eb245b760ff2207b52fb5 100644 (file)
@@ -54,13 +54,13 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
     * that no value has been explicitly set for this column, so ANALYZE
     * should use the default setting.
     */
-   int       attstattarget;
+   int32       attstattarget;
 
    /*
     * attlen is a copy of the typlen field from pg_type for this attribute.
     * See atttypid comments above.
     */
-   int       attlen;
+   int16       attlen;
 
    /*
     * attnum is the "attribute number" for the attribute:  A value that
@@ -75,13 +75,13 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
     *
     * Note that (attnum - 1) is often used as the index to an array.
     */
-   int       attnum;
+   int16       attnum;
 
    /*
     * attndims is the declared number of dimensions, if an array type,
     * otherwise zero.
     */
-   int       attndims;
+   int32       attndims;
 
    /*
     * fastgetattr() uses attcacheoff to cache byte offsets of attributes in
@@ -90,7 +90,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
     * descriptor, we may then update attcacheoff in the copies. This speeds
     * up the attribute walking process.
     */
-   int       attcacheoff;
+   int32       attcacheoff;
 
    /*
     * atttypmod records type-specific data supplied at table creation time
@@ -98,7 +98,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
     * type-specific input and output functions as the third argument. The
     * value will generally be -1 for types that do not need typmod.
     */
-   int       atttypmod;
+   int32       atttypmod;
 
    /*
     * attbyval is a copy of the typbyval field from pg_type for this
@@ -140,7 +140,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
    bool        attislocal;
 
    /* Number of times inherited from direct parent relation(s) */
-   int       attinhcount;
+   int32       attinhcount;
 
    /* attribute's collation */
    Oid         attcollation;
index e96c875f58a15c62d5652f2396c68a800993aa29..0843ce3c2646ba6a32fe1b5b5e323369b9704540 100644 (file)
@@ -52,7 +52,7 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MAC
    bool        rolcatupdate;   /* allowed to alter catalogs manually? */
    bool        rolcanlogin;    /* allowed to log in as session user? */
    bool        rolreplication; /* role used for streaming replication */
-   int       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 */
index a3307b44337e667280305562d82a63368c83821e..f83ce80a60361412db1326ac9a019df6c0df1aa6 100644 (file)
@@ -43,9 +43,9 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
 
    /* relfilenode == 0 means it is a "mapped" relation, see relmapper.c */
    Oid         reltablespace;  /* identifier of table space for relation */
-   int       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) */
-   int       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 */
@@ -53,14 +53,14 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
    bool        relisshared;    /* T if shared across databases */
    char        relpersistence; /* see RELPERSISTENCE_xxx constants below */
    char        relkind;        /* see RELKIND_xxx constants below */
-   int       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.
     */
-   int       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 */
index 8a1917e4f294dbc55da707aa403dcc284aa7bb59..a578562b037be42312cfcbfcfb0261e73ce59e36 100644 (file)
@@ -34,7 +34,7 @@ CATALOG(pg_collation,3456)
    NameData    collname;       /* collation name */
    Oid         collnamespace;  /* OID of namespace containing collation */
    Oid         collowner;      /* owner of collation */
-   int       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;
index b9e4bf41f93f659a1edcb0d857b587ae117489ad..fc048ea751085ceea9de43157a321a8bad180ef6 100644 (file)
@@ -86,7 +86,7 @@ CATALOG(pg_constraint,2606)
    bool        conislocal;
 
    /* Number of times inherited from direct parent relation(s) */
-   int       coninhcount;
+   int32       coninhcount;
 
    /* Has a local definition and cannot be inherited */
    bool        connoinherit;
@@ -97,12 +97,12 @@ CATALOG(pg_constraint,2606)
     * Columns of conrelid that the constraint applies to, if known (this is
     * NULL for trigger constraints)
     */
-   int       conkey[1];
+   int16       conkey[1];
 
    /*
     * If a foreign key, the referenced columns of confrelid
     */
-   int       confkey[1];
+   int16       confkey[1];
 
    /*
     * If a foreign key, the OIDs of the PK = FK equality operators for each
index 04fe3e87064d217172747ac19bb0b94b76ebbf79..318f9ca5cf13f6f7c8a01cb08820afeb778fa968 100644 (file)
@@ -42,8 +42,8 @@ CATALOG(pg_conversion,2607)
    NameData    conname;
    Oid         connamespace;
    Oid         conowner;
-   int       conforencoding;
-   int       contoencoding;
+   int32       conforencoding;
+   int32       contoencoding;
    regproc     conproc;
    bool        condefault;
 } FormData_pg_conversion;
index af803bba89b238ec504f086eaf435228f3cd2d85..d96628fe26ccc2371429f62219abdb591d3c2b43 100644 (file)
@@ -33,12 +33,12 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_M
 {
    NameData    datname;        /* database name */
    Oid         datdba;         /* owner of database */
-   int       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? */
-   int       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 */
index e56dd1ad3d01b9926d02b9dd1b6403a13bdf2ce8..f547e815b78bfa7946ad2722ca231fdcd3e7c97a 100644 (file)
@@ -37,14 +37,14 @@ CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS
     */
    Oid         classid;        /* OID of table containing object */
    Oid         objid;          /* OID of object itself */
-   int       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 */
-   int       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
index a454194893055f176a6197f784bb8f594f31c94d..c52e2dddff42fa0d19cb32380259013d752c9f4c 100644 (file)
@@ -49,7 +49,7 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS
 {
    Oid         objoid;         /* OID of object itself */
    Oid         classoid;       /* OID of table containing object */
-   int       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 */
index 9a86121cf9e6dc6693e8cd20f86e5b120b989986..934fe97e5f2e966b1ae038522ad74a97ad018af9 100644 (file)
@@ -32,7 +32,7 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
 {
    Oid         indexrelid;     /* OID of the index */
    Oid         indrelid;       /* OID of the relation it indexes */
-   int       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? */
index 18552bde7ec23b4aec3b3df0dbe2be5bd82044a2..5ed78987c97eab963450a591e00a38766bb9f138 100644 (file)
@@ -32,7 +32,7 @@ CATALOG(pg_inherits,2611) BKI_WITHOUT_OIDS
 {
    Oid         inhrelid;
    Oid         inhparent;
-   int       inhseqno;
+   int32       inhseqno;
 } FormData_pg_inherits;
 
 /* ----------------
index d442ec4e4a2d364e7119d53b2cbc90e69eccf210..d0195eaed95f507d6009b02152a9d9319762db5a 100644 (file)
@@ -31,7 +31,7 @@
 CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS
 {
    Oid         loid;           /* Identifier of large object */
-   int       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) */
index 256f474bb4e8219889108b22b2da363fde388fec..bee7154fd8cc7ff5835cd8e861d17d7bc1ce01bc 100644 (file)
@@ -50,8 +50,8 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO
    bool        proisstrict;    /* strict with respect to NULLs? */
    bool        proretset;      /* returns a set? */
    char        provolatile;    /* see PROVOLATILE_ categories below */
-   int       pronargs;       /* number of arguments */
-   int       pronargdefaults;    /* number of arguments with defaults */
+   int16       pronargs;       /* number of arguments */
+   int16       pronargdefaults;    /* number of arguments with defaults */
    Oid         prorettype;     /* OID of result type */
 
    /*
index 5171522da080511a9209d30eaf60ac8fb0e35f03..1ecdf1f3769b1db6f2a729fa4538fc4f92ea3b24 100644 (file)
@@ -35,7 +35,7 @@ CATALOG(pg_rewrite,2618)
 {
    NameData    rulename;
    Oid         ev_class;
-   int       ev_attr;
+   int16       ev_attr;
    char        ev_type;
    char        ev_enabled;
    bool        is_instead;
index 917efcf8ca9126f952600a6940edaca71212c7a5..26e2e52a1fe2c1491d592aa7395eae5b60d3d570 100644 (file)
@@ -24,7 +24,7 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS
 {
    Oid         objoid;         /* OID of the object itself */
    Oid         classoid;       /* OID of table containing the object */
-   int       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 */
index 394fe43c58219927bb9d0f788bc5e16e03a191f3..33ec08a6a4d7e6edc0fa444cb5c0eb18cf2407a0 100644 (file)
@@ -39,7 +39,7 @@ CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS
    Oid         dbid;           /* OID of database containing object */
    Oid         classid;        /* OID of table containing object */
    Oid         objid;          /* OID of object itself */
-   int       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
index 3ad0c281102f8071fc97620ee04a6b811282277a..8724cb50fa1d9451e99b2033c66fa1b96b1cd703 100644 (file)
@@ -32,7 +32,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
 {
    /* These fields form the unique key for the entry: */
    Oid         starelid;       /* relation containing attribute */
-   int       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: */
@@ -48,7 +48,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
     * the statistic, which is to estimate sizes of in-memory hash tables of
     * tuples.
     */
-   int       stawidth;
+   int32       stawidth;
 
    /* ----------------
     * stadistinct indicates the (approximate) number of distinct non-null
@@ -84,11 +84,11 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
     * ----------------
     */
 
-   int       stakind1;
-   int       stakind2;
-   int       stakind3;
-   int       stakind4;
-   int       stakind5;
+   int16       stakind1;
+   int16       stakind2;
+   int16       stakind3;
+   int16       stakind4;
+   int16       stakind5;
 
    Oid         staop1;
    Oid         staop2;
index 71afab58e56a4396b0d1de9b113562a03103602d..fb3a99468ad9983671e80e71e0d2cdf1d5b430e4 100644 (file)
@@ -38,7 +38,7 @@ CATALOG(pg_trigger,2620)
    Oid         tgrelid;        /* relation trigger is attached to */
    NameData    tgname;         /* trigger's name */
    Oid         tgfoid;         /* OID of function to be called */
-   int       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 */
@@ -48,7 +48,7 @@ CATALOG(pg_trigger,2620)
    Oid         tgconstraint;   /* associated pg_constraint entry, if any */
    bool        tgdeferrable;   /* constraint trigger is deferrable */
    bool        tginitdeferred; /* constraint trigger is deferred initially */
-   int       tgnargs;        /* # of extra arguments in tgargs */
+   int16       tgnargs;        /* # of extra arguments in tgargs */
 
    /*
     * Variable-length fields start here, but we allow direct access to
index c37733817432ac9a3ab9d0ba821acdf5b6dae582..f85e1997266deba126a10202379499c13dfffed3 100644 (file)
@@ -33,8 +33,8 @@
 CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS
 {
    Oid         mapcfg;         /* OID of configuration owning this entry */
-   int       maptokentype;   /* token type from parser */
-   int       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;
 
index 25c664b7c90ca3abb6730c91cdc7d984ee8bee67..2865340982bc8896a72bcede3e89cf70d3cbbfb6 100644 (file)
@@ -47,7 +47,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
     * "varlena" type (one that has a length word), -2 to indicate a
     * null-terminated C string.
     */
-   int       typlen;
+   int16       typlen;
 
    /*
     * typbyval determines whether internal Postgres routines pass a value of
@@ -185,13 +185,13 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
     * type (-1 if base type does not use a typmod).  -1 if this type is not a
     * domain.
     */
-   int       typtypmod;
+   int32       typtypmod;
 
    /*
     * typndims is the declared number of dimensions for an array domain type
     * (i.e., typbasetype is an array type).  Otherwise zero.
     */
-   int       typndims;
+   int32       typndims;
 
    /*
     * Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for
index 7a50d2fcb306bb9a5070b8f85f6e49d58e2f5ee7..d1a3a9b0534caa13f75f4dc6e4594bf40c733de3 100644 (file)
@@ -98,9 +98,9 @@ typedef struct VacAttrStats
     */
    bool        stats_valid;
    float4      stanullfrac;    /* fraction of entries that are NULL */
-   int       stawidth;       /* average width of column values */
+   int32       stawidth;       /* average width of column values */
    float4      stadistinct;    /* # distinct values */
-   int       stakind[STATISTIC_NUM_SLOTS];
+   int16       stakind[STATISTIC_NUM_SLOTS];
    Oid         staop[STATISTIC_NUM_SLOTS];
    int         numnumbers[STATISTIC_NUM_SLOTS];
    float4     *stanumbers[STATISTIC_NUM_SLOTS];
@@ -114,7 +114,7 @@ typedef struct VacAttrStats
     * elements. It should then overwrite these fields.
     */
    Oid         statypid[STATISTIC_NUM_SLOTS];
-   int       statyplen[STATISTIC_NUM_SLOTS];
+   int16       statyplen[STATISTIC_NUM_SLOTS];
    bool        statypbyval[STATISTIC_NUM_SLOTS];
    char        statypalign[STATISTIC_NUM_SLOTS];
 
index d5c18f2cf04074a15d3f92039158c65c8f5f4152..f8dffe060d96a0393cffa4d000972b0a8d1b0e60 100644 (file)
@@ -49,14 +49,14 @@ typedef struct
 typedef struct
 {
    HeadlineWordEntry *words;
-   int       lenwords;
-   int       curwords;
+   int32       lenwords;
+   int32       curwords;
    char       *startsel;
    char       *stopsel;
    char       *fragdelim;
-   int       startsellen;
-   int       stopsellen;
-   int       fragdelimlen;
+   int16       startsellen;
+   int16       stopsellen;
+   int16       fragdelimlen;
 } HeadlineParsedText;
 
 /*
index 3adc3369f9da0fb24b78fad9b54e0503f0e513f4..d80f7ade2be159f7000c6e44460dde8330d0ecba 100644 (file)
@@ -21,7 +21,7 @@
  *
  * 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
@@ -232,13 +232,13 @@ typedef union
 typedef struct
 {
    int32       vl_len_;        /* varlena header (do not touch directly!) */
-   int       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
index 1db4c4f78b4f15cd2e9c3783846ad496031597ac..d3088fe517f3baf309964c9f1a0a077319e50cfa 100644 (file)
@@ -42,7 +42,7 @@ typedef struct TSQueryParserStateData *TSQueryParserState;
 
 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);
@@ -53,7 +53,7 @@ extern TSQuery parse_tsquery(char *buf,
 
 /* 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);
 
@@ -83,12 +83,12 @@ typedef struct
 typedef struct
 {
    ParsedWord *words;
-   int       lenwords;
-   int       curwords;
-   int       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:
@@ -98,7 +98,7 @@ extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int4 buflen);
  */
 
 extern void hlparsetext(Oid cfgId, HeadlineParsedText *prs, TSQuery query,
-           char *buf, int4 buflen);
+           char *buf, int32 buflen);
 extern text *generateHeadline(HeadlineParsedText *prs);
 
 /*
@@ -164,14 +164,14 @@ extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS);
 /*
  * 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;
-   int       nchild;
+   int32       nchild;
    char       *word;
    uint32      sign;
    struct QTNode **child;
index d1e83707606610f65afa8ca4630af73c3f91757d..10634039a440e329d67a40e17dda944a4799911b 100644 (file)
@@ -256,7 +256,7 @@ extern Datum int2shl(PG_FUNCTION_ARGS);
 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);
index 343a793c95dd92b2181f021a397f2b6a8ae358a1..bc94f2f85947dc0baa3d0b380d387f22d1866235 100644 (file)
@@ -245,8 +245,8 @@ ecpg_build_compat_sqlda(int line, PGresult *res, int row, enum COMPAT_MODE compa
 /*
  * 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)