1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-28 11:55:03 +03:00

Use <stdint.h> and <inttypes.h> for c.h integers.

Redefine our exact width types with standard C99 types and macros,
including int64_t, INT64_MAX, INT64_C(), PRId64 etc.  We were already
using <stdint.h> types in a few places.

One complication is that Windows' <inttypes.h> uses format strings like
"%I64d", "%I32", "%I" for PRI*64, PRI*32, PTR*PTR, instead of mapping to
other standardized format strings like "%lld" etc as seen on other known
systems.  Teach our snprintf.c to understand them.

This removes a lot of configure clutter, and should also allow 64-bit
numbers and other standard types to be used in localized messages
without casting.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
This commit is contained in:
Thomas Munro
2024-12-04 14:46:59 +13:00
parent 3b08d5224d
commit 962da900ac
25 changed files with 272 additions and 582 deletions

View File

@@ -6568,13 +6568,13 @@ printResults(StatsData *total,
SimpleStats *cstats = &(*commands)->stats;
if (max_tries == 1)
printf(" %11.3f %10" INT64_MODIFIER "d %s\n",
printf(" %11.3f %10" PRId64 " %s\n",
(cstats->count > 0) ?
1000.0 * cstats->sum / cstats->count : 0.0,
(*commands)->failures,
(*commands)->first_line);
else
printf(" %11.3f %10" INT64_MODIFIER "d %10" INT64_MODIFIER "d %s\n",
printf(" %11.3f %10" PRId64 " %10" PRId64 " %s\n",
(cstats->count > 0) ?
1000.0 * cstats->sum / cstats->count : 0.0,
(*commands)->failures,