pgsql: Centralize definition of integer limits.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Centralize definition of integer limits.
Date: 2015-03-25 21:49:21
Message-ID: E1YatAv-0007cu-KW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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(dot)fsf(at)news-spur(dot)riddles(dot)org(dot)uk

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/83ff1618bc9d4e530d3ef2a668a71326784a753c

Modified Files
--------------
contrib/btree_gist/btree_ts.c | 4 +--
contrib/intarray/_int_gist.c | 4 ++-
contrib/pgbench/pgbench.c | 6 +----
src/backend/access/transam/xlog.c | 2 +-
src/backend/tsearch/wparser_def.c | 6 +++--
src/backend/utils/adt/int8.c | 2 +-
src/backend/utils/adt/numutils.c | 2 +-
src/backend/utils/adt/timestamp.c | 8 ------
src/backend/utils/adt/tsrank.c | 3 ++-
src/backend/utils/adt/txid.c | 2 +-
src/include/c.h | 41 +++++++++++++++++++++++++++++
src/include/datatype/timestamp.h | 4 +--
src/include/executor/instrument.h | 2 +-
src/include/nodes/parsenodes.h | 2 +-
src/include/pg_config_manual.h | 4 +--
src/include/port/atomics.h | 4 +--
src/include/storage/predicate_internals.h | 2 +-
src/include/utils/date.h | 6 ++---
18 files changed, 68 insertions(+), 36 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-03-25 23:05:45 pgsql: Add an ASSERT statement in plpgsql.
Previous Message Alvaro Herrera 2015-03-25 20:22:16 pgsql: Return ObjectAddress in many ALTER TABLE sub-routines

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-03-25 22:26:27 Re: Abbreviated keys for Numeric
Previous Message Alvaro Herrera 2015-03-25 20:26:27 Re: deparsing utility commands