diff options
| author | Andres Freund <andres@anarazel.de> | 2015-03-25 22:39:42 +0100 |
|---|---|---|
| committer | Andres Freund <andres@anarazel.de> | 2015-03-25 22:39:42 +0100 |
| commit | 83ff1618bc9d4e530d3ef2a668a71326784a753c (patch) | |
| tree | d295d560bd4481a61a6f5d036888ed7954b4b86b /src/include/utils/date.h | |
| parent | bdc3d7fa2376a7a1e977383cc3221cfe44c4a893 (diff) | |
| download | postgresql-83ff1618bc9d4e530d3ef2a668a71326784a753c.tar.gz | |
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
Diffstat (limited to 'src/include/utils/date.h')
| -rw-r--r-- | src/include/utils/date.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/include/utils/date.h b/src/include/utils/date.h index b57f4bb3ea..f07011c385 100644 --- a/src/include/utils/date.h +++ b/src/include/utils/date.h @@ -35,11 +35,9 @@ typedef struct /* * Infinity and minus infinity must be the max and min values of DateADT. - * We could use INT_MIN and INT_MAX here, but seems better to not assume that - * int32 == int. */ -#define DATEVAL_NOBEGIN ((DateADT) (-0x7fffffff - 1)) -#define DATEVAL_NOEND ((DateADT) 0x7fffffff) +#define DATEVAL_NOBEGIN ((DateADT) INT32_MIN) +#define DATEVAL_NOEND ((DateADT) INT32_MAX) #define DATE_NOBEGIN(j) ((j) = DATEVAL_NOBEGIN) #define DATE_IS_NOBEGIN(j) ((j) == DATEVAL_NOBEGIN) |
