diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-07-09 17:40:31 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-07-09 17:40:31 +0000 |
commit | 103cf75651cea270d1e00dfd960a7f218fc5e8c4 (patch) | |
tree | 3b08693dcc5a4627ca3b15866da93fb63678262e /src/backend/utils/adt/numutils.c | |
parent | cd5dfb65a9318e2e64feb9b39540f5f4a8c27da7 (diff) | |
download | postgresql-103cf75651cea270d1e00dfd960a7f218fc5e8c4.tar.gz postgresql-103cf75651cea270d1e00dfd960a7f218fc5e8c4.zip |
Re-apply range check patch after fixing LIMIT_H test and defines.
Diffstat (limited to 'src/backend/utils/adt/numutils.c')
-rw-r--r-- | src/backend/utils/adt/numutils.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 6c1cec51d75..e975df5e9fb 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -10,14 +10,14 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.32 1999/07/09 03:27:20 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.33 1999/07/09 17:40:31 momjian Exp $ * *------------------------------------------------------------------------- */ #include <stdio.h> /* for sprintf() */ #include <errno.h> #include <math.h> -#ifdef HAVE_LIMITS +#ifdef HAVE_LIMITS_H #include <limits.h> #endif #include "postgres.h" @@ -32,19 +32,19 @@ #define INT_MAX (0x7FFFFFFFL) #endif #ifndef INT_MIN -#define INT_MIN (-0x80000000L) +#define INT_MIN (-INT_MAX-1) #endif #ifndef SHRT_MAX #define SHRT_MAX (0x7FFF) #endif #ifndef SHRT_MIN -#define SHRT_MIN (-0x8000) +#define SHRT_MIN (-SHRT_MAX-1) #endif #ifndef SCHAR_MAX #define SCHAR_MAX (0x7F) #endif #ifndef SCHAR_MIN -#define SCHAR_MIN (-0x80) +#define SCHAR_MIN (-SCHAR_MAX-1) #endif int32 @@ -76,7 +76,7 @@ pg_atoi(char *s, int size, int c) switch (size) { case sizeof(int32): -#ifdef HAS_LONG_LONG +#if defined(HAVE_LONG_INT_64) || defined(HAVE_LONG_LONG_INT_64) /* won't get ERANGE on these with 64-bit longs... */ if (l < INT_MIN) { @@ -88,7 +88,7 @@ pg_atoi(char *s, int size, int c) errno = ERANGE; elog(ERROR, "pg_atoi: error reading \"%s\": %m", s); } -#endif /* HAS_LONG_LONG */ +#endif /* HAVE_LONG_INT_64 or HAVE_LONG_LONG_INT_64 */ break; case sizeof(int16): if (l < SHRT_MIN) |