summaryrefslogtreecommitdiff
path: root/src/bin/pg_waldump/pg_waldump.c
diff options
context:
space:
mode:
authorThomas Munro2024-12-04 01:46:59 +0000
committerThomas Munro2024-12-04 02:05:38 +0000
commit962da900ac8f0927f1af2fd811ca67fa163c873a (patch)
tree5839c22d2ad7bc68ddfd1e4debc734ef5df3a9d1 /src/bin/pg_waldump/pg_waldump.c
parent3b08d5224d7df71cc111d8522cf6190fc02f6fb9 (diff)
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 <[email protected]> Discussion: https://postgr.es/m/ME3P282MB3166F9D1F71F787929C0C7E7B6312%40ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Diffstat (limited to 'src/bin/pg_waldump/pg_waldump.c')
-rw-r--r--src/bin/pg_waldump/pg_waldump.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 1f9403fc5cf..c4b04d62965 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -610,10 +610,10 @@ XLogDumpStatsRow(const char *name,
tot_len_pct = 100 * (double) tot_len / total_len;
printf("%-27s "
- "%20" INT64_MODIFIER "u (%6.02f) "
- "%20" INT64_MODIFIER "u (%6.02f) "
- "%20" INT64_MODIFIER "u (%6.02f) "
- "%20" INT64_MODIFIER "u (%6.02f)\n",
+ "%20" PRIu64 " (%6.02f) "
+ "%20" PRIu64 " (%6.02f) "
+ "%20" PRIu64 " (%6.02f) "
+ "%20" PRIu64 " (%6.02f)\n",
name, n, n_pct, rec_len, rec_len_pct, fpi_len, fpi_len_pct,
tot_len, tot_len_pct);
}
@@ -742,10 +742,10 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogStats *stats)
fpi_len_pct = 100 * (double) total_fpi_len / total_len;
printf("%-27s "
- "%20" INT64_MODIFIER "u %-9s"
- "%20" INT64_MODIFIER "u %-9s"
- "%20" INT64_MODIFIER "u %-9s"
- "%20" INT64_MODIFIER "u %-6s\n",
+ "%20" PRIu64 " %-9s"
+ "%20" PRIu64 " %-9s"
+ "%20" PRIu64 " %-9s"
+ "%20" PRIu64 " %-6s\n",
"Total", stats->count, "",
total_rec_len, psprintf("[%.02f%%]", rec_len_pct),
total_fpi_len, psprintf("[%.02f%%]", fpi_len_pct),