1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +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,14 +49,14 @@ typedef struct
typedef struct
{
HeadlineWordEntry *words;
int4 lenwords;
int4 curwords;
int32 lenwords;
int32 curwords;
char *startsel;
char *stopsel;
char *fragdelim;
int2 startsellen;
int2 stopsellen;
int2 fragdelimlen;
int16 startsellen;
int16 stopsellen;
int16 fragdelimlen;
} HeadlineParsedText;
/*

View 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!) */
int4 size; /* number of QueryItems */
int32 size; /* number of QueryItems */
char data[1]; /* data starts here */
} TSQueryData;
typedef TSQueryData *TSQuery;
#define HDRSIZETQ ( VARHDRSZ + sizeof(int4) )
#define HDRSIZETQ ( VARHDRSZ + sizeof(int32) )
/* Computes the size of header and all QueryItems. size is the number of
* QueryItems, and lenofoperand is the total length of all operands

View 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;
int4 lenwords;
int4 curwords;
int4 pos;
int32 lenwords;
int32 curwords;
int32 pos;
} ParsedText;
extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int4 buflen);
extern void parsetext(Oid cfgId, ParsedText *prs, char *buf, int32 buflen);
/*
* headline framework, flow in common to generate:
@@ -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;
int4 nchild;
int32 nchild;
char *word;
uint32 sign;
struct QTNode **child;