1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +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

@ -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!) */
int4 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
{
int2 type;
int2 left;
int4 val;
int16 type;
int16 left;
int32 val;
} ITEM;
typedef struct QUERYTYPE
{
int32 vl_len_; /* varlena header (do not touch directly!) */
int4 size; /* number of ITEMs */
int32 size; /* number of ITEMs */
ITEM items[1]; /* variable length array */
} QUERYTYPE;
@ -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)