1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Centralize definition of integer limits.

Several submitted and even committed patches have run into the problem
that C89, our baseline, does not provide minimum/maximum values for
various integer datatypes. C99's stdint.h does, but we can't rely on
it.

Several parts of the code defined limits locally, so instead centralize
the definitions to c.h.

This patch also changes the more obvious usages of literal limit values;
there's more places that could be changed, but it's less clear whether
it's beneficial to change those.

Author: Andrew Gierth
Discussion: 87619tc5wc.fsf@news-spur.riddles.org.uk
This commit is contained in:
Andres Freund
2015-03-25 22:39:42 +01:00
parent bdc3d7fa23
commit 83ff1618bc
18 changed files with 68 additions and 36 deletions

View File

@@ -119,8 +119,8 @@ typedef struct
* DT_NOBEGIN represents timestamp -infinity; DT_NOEND represents +infinity
*/
#ifdef HAVE_INT64_TIMESTAMP
#define DT_NOBEGIN (-INT64CONST(0x7fffffffffffffff) - 1)
#define DT_NOEND (INT64CONST(0x7fffffffffffffff))
#define DT_NOBEGIN INT64_MIN
#define DT_NOEND INT64_MAX
#else /* !HAVE_INT64_TIMESTAMP */
#ifdef HUGE_VAL
#define DT_NOBEGIN (-HUGE_VAL)