diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2012-06-25 01:51:46 +0300 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2012-06-25 01:51:46 +0300 |
commit | b8b2e3b2deeaab19715af063fc009b7c230b2336 (patch) | |
tree | c6ee1310487d59e37e3e143835b5609e78524f65 /src/backend | |
parent | 7eb8c7851458eb88def80c290a4b5bc37cc321f3 (diff) | |
download | postgresql-b8b2e3b2deeaab19715af063fc009b7c230b2336.tar.gz postgresql-b8b2e3b2deeaab19715af063fc009b7c230b2336.zip |
Replace int2/int4 in C code with int16/int32
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.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/access/hash/hashfunc.c | 2 | ||||
-rw-r--r-- | src/backend/access/spgist/spgquadtreeproc.c | 2 | ||||
-rw-r--r-- | src/backend/catalog/Catalog.pm | 2 | ||||
-rw-r--r-- | src/backend/catalog/namespace.c | 2 | ||||
-rw-r--r-- | src/backend/catalog/pg_type.c | 2 | ||||
-rw-r--r-- | src/backend/commands/cluster.c | 4 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 18 | ||||
-rw-r--r-- | src/backend/optimizer/prep/prepunion.c | 2 | ||||
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 2 | ||||
-rw-r--r-- | src/backend/tsearch/to_tsany.c | 14 | ||||
-rw-r--r-- | src/backend/tsearch/ts_parse.c | 2 | ||||
-rw-r--r-- | src/backend/tsearch/wparser_def.c | 22 | ||||
-rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/int.c | 8 | ||||
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 6 | ||||
-rw-r--r-- | src/backend/utils/adt/tsginidx.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/tsgistidx.c | 78 | ||||
-rw-r--r-- | src/backend/utils/adt/tsquery.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/tsquery_gist.c | 8 | ||||
-rw-r--r-- | src/backend/utils/adt/tsrank.c | 12 | ||||
-rw-r--r-- | src/backend/utils/adt/tsvector.c | 2 | ||||
-rw-r--r-- | src/backend/utils/adt/tsvector_op.c | 10 |
22 files changed, 104 insertions, 102 deletions
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 0e4cf8e0a3e..033674652db 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -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 diff --git a/src/backend/access/spgist/spgquadtreeproc.c b/src/backend/access/spgist/spgquadtreeproc.c index 5da265025e6..e8fdc4990ba 100644 --- a/src/backend/access/spgist/spgquadtreeproc.c +++ b/src/backend/access/spgist/spgquadtreeproc.c @@ -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) || diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index cdb0bee1305..0be29e304e6 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -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' diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 1b6bb3bb6d7..20850ab034a 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -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; diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 5b2ad6bfe0d..6062926e604 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -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); diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index a72b0ad5ff2..cfec413d54f 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -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 */ { - int4 swap_pages; + int32 swap_pages; float4 swap_tuples; - int4 swap_allvisible; + int32 swap_allvisible; swap_pages = relform1->relpages; relform1->relpages = relform2->relpages; diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 834b694ec6b..faa7f0c4c50 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -121,7 +121,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, { int16 tgtype; int ncolumns; - int2 *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)); - int2 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) { - int2 *newattr; + int16 *newattr; - newattr = (int2 *) palloc(trigger->tgnattr * sizeof(int2)); + newattr = (int16 *) palloc(trigger->tgnattr * sizeof(int16)); memcpy(newattr, trigger->tgattr, - trigger->tgnattr * sizeof(int2)); + trigger->tgnattr * sizeof(int16)); trigger->tgattr = newattr; } if (trigger->tgnargs > 0) @@ -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) diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 6475633ae7d..8ee6cf7f0e0 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -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); diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 8810d0dbad5..adc0d5b775e 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -1578,7 +1578,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) for (i = 0; i < index_form->indnatts; i++) { - int2 attnum = index_form->indkey.values[i]; + int16 attnum = index_form->indkey.values[i]; Form_pg_attribute attform; char *attname; Oid defopclass; diff --git a/src/backend/tsearch/to_tsany.c b/src/backend/tsearch/to_tsany.c index bb886ee5849..7a4fa93ee75 100644 --- a/src/backend/tsearch/to_tsany.c +++ b/src/backend/tsearch/to_tsany.c @@ -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) { - int4 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; - int4 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); - int4 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; - int4 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); - int4 lenoperand = VARSIZE(query) - (oldoperand - (char *) query); + int32 lenoperand = VARSIZE(query) - (oldoperand - (char *) query); Assert(len < query->size); diff --git a/src/backend/tsearch/ts_parse.c b/src/backend/tsearch/ts_parse.c index 805fa25d5ee..ae59c34938c 100644 --- a/src/backend/tsearch/ts_parse.c +++ b/src/backend/tsearch/ts_parse.c @@ -592,7 +592,7 @@ generateHeadline(HeadlineParsedText *prs) char *ptr; int len = 128; int numfragments = 0; - int2 infrag = 0; + int16 infrag = 0; HeadlineWordEntry *wrd = prs->words; diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index f2ec784ac23..56763412f3b 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -2133,12 +2133,12 @@ mark_fragment(HeadlineParsedText *prs, int highlight, int startpos, int endpos) typedef struct { - int4 startpos; - int4 endpos; - int4 poslen; - int4 curlen; - int2 in; - int2 excluded; + int32 startpos; + int32 endpos; + int32 poslen; + int32 curlen; + int16 in; + int16 excluded; } CoverPos; static void @@ -2191,24 +2191,24 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, int highlight, int shortword, int min_words, int max_words, int max_fragments) { - int4 poslen, + int32 poslen, curlen, i, f, num_f = 0; - int4 stretch, + int32 stretch, maxstretch, posmarker; - int4 startpos = 0, + int32 startpos = 0, endpos = 0, p = 0, q = 0; - int4 numcovers = 0, + int32 numcovers = 0, maxcovers = 32; - int4 minI, + int32 minI, minwords, maxitems; CoverPos *covers; diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 5582a06c7f2..c221c20c9f6 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -4713,8 +4713,8 @@ array_smaller(PG_FUNCTION_ARGS) typedef struct generate_subscripts_fctx { - int4 lower; - int4 upper; + int32 lower; + int32 upper; bool reverse; } generate_subscripts_fctx; diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index a339abf17b6..4be39014495 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -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); } diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 5bf3533a114..ec93149f3e7 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -2394,7 +2394,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, char *rulename; char ev_type; Oid ev_class; - int2 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; - int2 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); diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 8900c0f4978..8b045c6e739 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -109,7 +109,7 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) if (query->size > 0) { QueryItem *item = GETQUERY(query); - int4 i, + int32 i, j; bool *partialmatch; int *map_item_operand; diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 674e48c871d..dd8164b9dfe 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -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!) */ - int4 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) { - int4 *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) { - int4 k, + int32 k, len = ARRNELEM(a); - int4 *ptr = GETARR(a); + int32 *ptr = GETARR(a); MemSet((void *) sign, 0, sizeof(BITVEC)); for (k = 0; k < len; k++) @@ -186,8 +186,8 @@ gtsvector_compress(PG_FUNCTION_ARGS) { /* tsvector */ SignTSVector *res; TSVector val = DatumGetTSVector(entry->key); - int4 len; - int4 *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))) { - int4 i, + int32 i, len; SignTSVector *res; BITVECP sign = GETSIGN(DatumGetPointer(entry->key)); @@ -289,8 +289,8 @@ gtsvector_decompress(PG_FUNCTION_ARGS) typedef struct { - int4 *arrb; - int4 *arre; + int32 *arrb; + int32 *arre; } CHKVAL; /* @@ -299,9 +299,9 @@ typedef struct static bool checkcondition_arr(void *checkval, QueryOperand *val) { - int4 *StopLow = ((CHKVAL *) checkval)->arrb; - int4 *StopHigh = ((CHKVAL *) checkval)->arre; - int4 *StopMiddle; + int32 *StopLow = ((CHKVAL *) checkval)->arrb; + int32 *StopHigh = ((CHKVAL *) checkval)->arre; + int32 *StopMiddle; /* Loop invariant: StopLow <= val < StopHigh */ @@ -378,10 +378,10 @@ gtsvector_consistent(PG_FUNCTION_ARGS) } } -static int4 +static int32 unionkey(BITVECP sbase, SignTSVector *add) { - int4 i; + int32 i; if (ISSIGNKEY(add)) { @@ -395,7 +395,7 @@ unionkey(BITVECP sbase, SignTSVector *add) } else { - int4 *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; - int4 i, + int32 i, len; - int4 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 { - int4 i; + int32 i; BITVECP sa = GETSIGN(a), sb = GETSIGN(b); @@ -471,16 +471,16 @@ gtsvector_same(PG_FUNCTION_ARGS) } else { /* a and b ISARRKEY */ - int4 lena = ARRNELEM(a), + int32 lena = ARRNELEM(a), lenb = ARRNELEM(b); if (lena != lenb) *result = false; else { - int4 *ptra = GETARR(a), + int32 *ptra = GETARR(a), *ptrb = GETARR(b); - int4 i; + int32 i; *result = true; for (i = 0; i < lena; i++) @@ -495,10 +495,10 @@ gtsvector_same(PG_FUNCTION_ARGS) PG_RETURN_POINTER(result); } -static int4 +static int32 sizebitvec(BITVECP sign) { - int4 size = 0, + int32 size = 0, i; LOOPBYTE @@ -587,7 +587,7 @@ fillcache(CACHESIGN *item, SignTSVector *key) typedef struct { OffsetNumber pos; - int4 cost; + int32 cost; } SPLITCOST; static int @@ -630,11 +630,11 @@ gtsvector_picksplit(PG_FUNCTION_ARGS) *datum_r; BITVECP union_l, union_r; - int4 size_alpha, + int32 size_alpha, size_beta; - int4 size_waste, + int32 size_waste, waste = -1; - int4 nbytes; + int32 nbytes; OffsetNumber seed_1 = 0, seed_2 = 0; OffsetNumber *left, diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 6e1f8cfdb0d..010167a8a92 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -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; diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index 74e40246c42..f76f9fb54e3 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -150,7 +150,7 @@ gtsquery_penalty(PG_FUNCTION_ARGS) typedef struct { OffsetNumber pos; - int4 cost; + int32 cost; } SPLITCOST; static int @@ -174,11 +174,11 @@ gtsquery_picksplit(PG_FUNCTION_ARGS) j; TSQuerySign datum_l, datum_r; - int4 size_alpha, + int32 size_alpha, size_beta; - int4 size_waste, + int32 size_waste, waste = -1; - int4 nbytes; + int32 nbytes; OffsetNumber seed_1 = 0, seed_2 = 0; OffsetNumber *left, diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c index a45caf05af5..acda098db1a 100644 --- a/src/backend/utils/adt/tsrank.c +++ b/src/backend/utils/adt/tsrank.c @@ -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; - int4 dimt, + int32 dimt, lenct, dist, nitem; @@ -283,7 +283,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q) WordEntry *entry, *firstentry; WordEntryPos *post; - int4 dimt, + int32 dimt, j, i, nitem; @@ -297,7 +297,7 @@ calc_rank_or(float *w, TSVector t, TSQuery q) { float resj, wjm; - int4 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; - int4 dimt, + int32 dimt, j, i, nitem; diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c index 8a81f3d8295..688e3652c72 100644 --- a/src/backend/utils/adt/tsvector.c +++ b/src/backend/utils/adt/tsvector.c @@ -309,7 +309,7 @@ tsvectorout(PG_FUNCTION_ARGS) { TSVector out = PG_GETARG_TSVECTOR(0); char *outbuf; - int4 i, + int32 i, lenbuf = 0, pp; WordEntry *ptr = ARRPTR(out); diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index eb5c45b3d81..34be330522c 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -51,7 +51,7 @@ typedef struct StatEntry typedef struct { - int4 weight; + int32 weight; uint32 maxdepth; @@ -221,7 +221,7 @@ Datum tsvector_length(PG_FUNCTION_ARGS) { TSVector in = PG_GETARG_TSVECTOR(0); - int4 ret = in->size; + int32 ret = in->size; PG_FREE_IF_COPY(in, 0); PG_RETURN_INT32(ret); @@ -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; |