From f512a6e1323eefa843a063e466babb96d7bfb4ce Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 12 Dec 2017 18:15:22 -0800 Subject: [PATCH] Consistently use PG_INT(16|32|64)_(MIN|MAX). Per buildfarm animal woodlouse. --- contrib/btree_gist/btree_cash.c | 2 +- contrib/btree_gist/btree_int2.c | 2 +- contrib/btree_gist/btree_int4.c | 2 +- contrib/btree_gist/btree_int8.c | 2 +- src/backend/utils/adt/int.c | 6 +++--- src/backend/utils/adt/int8.c | 10 +++++----- src/backend/utils/adt/numeric.c | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c index 18f45f2750..894d0a2665 100644 --- a/contrib/btree_gist/btree_cash.c +++ b/contrib/btree_gist/btree_cash.c @@ -101,7 +101,7 @@ cash_dist(PG_FUNCTION_ARGS) Cash ra; if (pg_sub_s64_overflow(a, b, &r) || - r == INT64_MIN) + r == PG_INT64_MIN) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("money out of range"))); diff --git a/contrib/btree_gist/btree_int2.c b/contrib/btree_gist/btree_int2.c index c2af4cd566..7674e2d292 100644 --- a/contrib/btree_gist/btree_int2.c +++ b/contrib/btree_gist/btree_int2.c @@ -100,7 +100,7 @@ int2_dist(PG_FUNCTION_ARGS) int16 ra; if (pg_sub_s16_overflow(a, b, &r) || - r == INT16_MIN) + r == PG_INT16_MIN) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("smallint out of range"))); diff --git a/contrib/btree_gist/btree_int4.c b/contrib/btree_gist/btree_int4.c index f2b6dec660..80005ab65d 100644 --- a/contrib/btree_gist/btree_int4.c +++ b/contrib/btree_gist/btree_int4.c @@ -101,7 +101,7 @@ int4_dist(PG_FUNCTION_ARGS) int32 ra; if (pg_sub_s32_overflow(a, b, &r) || - r == INT32_MIN) + r == PG_INT32_MIN) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("integer out of range"))); diff --git a/contrib/btree_gist/btree_int8.c b/contrib/btree_gist/btree_int8.c index 16db0028b7..b0fd3e1277 100644 --- a/contrib/btree_gist/btree_int8.c +++ b/contrib/btree_gist/btree_int8.c @@ -101,7 +101,7 @@ int8_dist(PG_FUNCTION_ARGS) int64 ra; if (pg_sub_s64_overflow(a, b, &r) || - r == INT64_MIN) + r == PG_INT64_MIN) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index 36ba86ca73..d6eb16a907 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -794,7 +794,7 @@ int2div(PG_FUNCTION_ARGS) */ if (arg2 == -1) { - if (unlikely(arg1 == INT16_MIN)) + if (unlikely(arg1 == PG_INT16_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("smallint out of range"))); @@ -1018,7 +1018,7 @@ int4abs(PG_FUNCTION_ARGS) int32 arg1 = PG_GETARG_INT32(0); int32 result; - if (unlikely(arg1 == INT32_MIN)) + if (unlikely(arg1 == PG_INT32_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("integer out of range"))); @@ -1032,7 +1032,7 @@ int2abs(PG_FUNCTION_ARGS) int16 arg1 = PG_GETARG_INT16(0); int16 result; - if (unlikely(arg1 == INT16_MIN)) + if (unlikely(arg1 == PG_INT16_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("smallint out of range"))); diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index bc8dad5c5d..42bb6ebe2f 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -103,7 +103,7 @@ scanint8(const char *str, bool errorOK, int64 *result) if (!neg) { - if (unlikely(tmp == INT64_MIN)) + if (unlikely(tmp == PG_INT64_MIN)) goto out_of_range; tmp = -tmp; } @@ -564,7 +564,7 @@ int8div(PG_FUNCTION_ARGS) */ if (arg2 == -1) { - if (unlikely(arg1 == INT64_MIN)) + if (unlikely(arg1 == PG_INT64_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); @@ -588,7 +588,7 @@ int8abs(PG_FUNCTION_ARGS) int64 arg1 = PG_GETARG_INT64(0); int64 result; - if (unlikely(arg1 == INT64_MIN)) + if (unlikely(arg1 == PG_INT64_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); @@ -822,7 +822,7 @@ int84div(PG_FUNCTION_ARGS) */ if (arg2 == -1) { - if (unlikely(arg1 == INT64_MIN)) + if (unlikely(arg1 == PG_INT64_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); @@ -964,7 +964,7 @@ int82div(PG_FUNCTION_ARGS) */ if (arg2 == -1) { - if (unlikely(arg1 == INT64_MIN)) + if (unlikely(arg1 == PG_INT64_MIN)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("bigint out of range"))); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index e9a6ca3535..9830988701 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -6226,7 +6226,7 @@ numericvar_to_int64(const NumericVar *var, int64 *result) if (!neg) { - if (unlikely(val == INT64_MIN)) + if (unlikely(val == PG_INT64_MIN)) return false; val = -val; } -- 2.40.0