Subject: pgsql: Use PRI*64 instead of "ll*" in format strings (minimal trial)

From: Peter Eisentraut <[email-masked]>
Date: Sun, 02 Mar 2025 13:03:34 +0000

Use PRI*64 instead of "ll*" in format strings (minimal trial)

Old: errmsg("hello %llu", (unsigned long long) x)
New: errmsg("hello %" PRIu64, x)

And likewise for everything printf-like.

In the past we had to use long long so localized format strings remained
architecture independent in message catalogs.  Although long long is
expected to be 64 bit everywhere, if we hadn't also cast the int64
values, we'd have generated compiler warnings on systems where int64 was
long.

Now that int64 is int64_t, C99 understand how to format them using
<inttypes.h> macros, the casts are not necessary, and the gettext()
tools recognize the macros and defer expansion until load time.  (And if
we ever manage to get -Wformat-signedness to work for us, that'd help
with these too, but not the type-system-clobbering casts.)

This particular patch converts only pg_checksums.c to the new system,
to allow testing of the translation toolchain for everyone.  If this
works okay, a later patch will convert most of the rest.

Author: Thomas Munro <[email-masked]>
Discussion: https://postgr.es/m/b936d2fb-590d-49c3-a615-92c3a88c6c19%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/15a79c73111f0c9738ee81b796f7de5bfeb3aedc

Modified Files
--------------
src/bin/pg_checksums/pg_checksums.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)