aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/int.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2012-06-25 01:51:46 +0300
committerPeter Eisentraut <peter_e@gmx.net>2012-06-25 01:51:46 +0300
commitb8b2e3b2deeaab19715af063fc009b7c230b2336 (patch)
treec6ee1310487d59e37e3e143835b5609e78524f65 /src/backend/utils/adt/int.c
parent7eb8c7851458eb88def80c290a4b5bc37cc321f3 (diff)
downloadpostgresql-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/utils/adt/int.c')
-rw-r--r--src/backend/utils/adt/int.c8
1 files changed, 4 insertions, 4 deletions
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);
}