1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

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.
This commit is contained in:
Peter Eisentraut
2012-06-25 01:51:46 +03:00
parent 7eb8c78514
commit b8b2e3b2de
75 changed files with 411 additions and 404 deletions

View 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)
{
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);

View File

@@ -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;

View File

@@ -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;