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:
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user