You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Allow use of "z" flag in our printf calls, and use it where appropriate.
Since C99, it's been standard for printf and friends to accept a "z" sizemodifier, meaning "whatever size size_t has". Up to now we've generallydealt with printing size_t values by explicitly casting them to unsignedlong and using the "l" modifier; but this is really the wrong thing onplatforms where pointers are wider than longs (such as Win64). So let'sstart using "z" instead. To ensure we can do that on all platforms, teachsrc/port/snprintf.c to understand "z", and add a configure test to forceuse of that implementation when the platform's version doesn't handle "z".Having done that, modify a bunch of places that were using theunsigned-long hack to use "z" instead. This patch doesn't pretend to havegotten everyplace that could benefit, but it catches many of them. I madean effort in particular to ensure that all uses of the same error messagetext were updated together, so as not to increase the number oftranslatable strings.It's possible that this change will result in format-string warnings frompre-C99 compilers. We might have to reconsider if there are any popularcompilers that will warn about this; but let's start by seeing what thebuildfarm thinks.Andres Freund, with a little additional work by me