mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
ac4ef637ad
Since C99, it's been standard for printf and friends to accept a "z" size modifier, meaning "whatever size size_t has". Up to now we've generally dealt with printing size_t values by explicitly casting them to unsigned long and using the "l" modifier; but this is really the wrong thing on platforms where pointers are wider than longs (such as Win64). So let's start using "z" instead. To ensure we can do that on all platforms, teach src/port/snprintf.c to understand "z", and add a configure test to force use of that implementation when the platform's version doesn't handle "z". Having done that, modify a bunch of places that were using the unsigned-long hack to use "z" instead. This patch doesn't pretend to have gotten everyplace that could benefit, but it catches many of them. I made an effort in particular to ensure that all uses of the same error message text were updated together, so as not to increase the number of translatable strings. It's possible that this change will result in format-string warnings from pre-C99 compilers. We might have to reconsider if there are any popular compilers that will warn about this; but let's start by seeing what the buildfarm thinks. Andres Freund, with a little additional work by me |
||
---|---|---|
.. | ||
ac_func_accept_argtypes.m4 | ||
acx_pthread.m4 | ||
c-compiler.m4 | ||
c-library.m4 | ||
config.guess | ||
config.sub | ||
docbook.m4 | ||
general.m4 | ||
install-sh | ||
libtool.m4 | ||
Makefile | ||
missing | ||
perl.m4 | ||
prep_buildtree | ||
programs.m4 | ||
python.m4 | ||
tcl.m4 |