diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-03-12 12:17:58 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-03-13 09:56:25 -0400 |
commit | 6cf86f435472b27bbc5e22c713bca08aa2d94af7 (patch) | |
tree | c1722f6bb851bcb468a2d01edf23f872c0b89597 /src/backend/nodes/read.c | |
parent | 377b5ac4845c5ffbf992ee95c32d7d16d38b9081 (diff) | |
download | postgresql-6cf86f435472b27bbc5e22c713bca08aa2d94af7.tar.gz postgresql-6cf86f435472b27bbc5e22c713bca08aa2d94af7.zip |
Change internal integer representation of Value node
A Value node would store an integer as a long. This causes needless
portability risks, as long can be of varying sizes. Change it to use
int instead. All code using this was already careful to only store
32-bit values anyway.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Diffstat (limited to 'src/backend/nodes/read.c')
-rw-r--r-- | src/backend/nodes/read.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c index 76414029d83..6e9fa45e37e 100644 --- a/src/backend/nodes/read.c +++ b/src/backend/nodes/read.c @@ -224,13 +224,9 @@ nodeTokenType(char *token, int length) errno = 0; val = strtol(token, &endptr, 10); - (void) val; /* avoid compiler warning if unused */ - if (endptr != token + length || errno == ERANGE -#ifdef HAVE_LONG_INT_64 - /* if long > 32 bits, check for overflow of int4 */ - || val != (long) ((int32) val) -#endif - ) + if (endptr != token + length || errno == ERANGE || + /* check for overflow of int */ + val != (int) val) return T_Float; return T_Integer; } @@ -387,9 +383,9 @@ nodeRead(char *token, int tok_len) case T_Integer: /* - * we know that the token terminates on a char atol will stop at + * we know that the token terminates on a char atoi will stop at */ - result = (Node *) makeInteger(atol(token)); + result = (Node *) makeInteger(atoi(token)); break; case T_Float: { |