From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Use PRI*64 instead of "ll*" in format strings (minimal trial) |
Date: | 2025-03-02 13:03:34 |
Message-ID: | E1toiyk-000R0U-1o@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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 <thomas(dot)munro(at)gmail(dot)com>
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2025-03-03 00:16:31 | pgsql: postgres_fdw: Extend postgres_fdw_get_connections to return remo |
Previous Message | Tom Lane | 2025-03-01 19:23:23 | pgsql: Fix pg_strtof() to not crash on NULL endptr. |