mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Always use our own versions of *printf().
We've spent an awful lot of effort over the years in coping with platform-specific vagaries of the *printf family of functions. Let's just forget all that mess and standardize on always using src/port/snprintf.c. This gets rid of a lot of configure logic, and it will allow a saner approach to dealing with %m (though actually changing that is left for a follow-on patch). Preliminary performance testing suggests that as it stands, snprintf.c is faster than the native printf functions for some tasks on some platforms, and slower for other cases. A pending patch will improve that, though cases with floating-point conversions will doubtless remain slower unless we want to put a *lot* of effort into that. Still, we've not observed that *printf is really a performance bottleneck for most workloads, so I doubt this matters much. Patch by me, reviewed by Michael Paquier Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
This commit is contained in:
@ -33,11 +33,8 @@
|
||||
* Sometimes python carefully scribbles on our *printf macros.
|
||||
* So we undefine them here and redefine them after it's done its dirty deed.
|
||||
*/
|
||||
|
||||
#ifdef USE_REPL_SNPRINTF
|
||||
#undef snprintf
|
||||
#undef vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
/* Python uses #pragma to bring in a non-default libpython on VC++ if
|
||||
@ -124,7 +121,6 @@ typedef int Py_ssize_t;
|
||||
#include <eval.h>
|
||||
|
||||
/* put back our snprintf and vsnprintf */
|
||||
#ifdef USE_REPL_SNPRINTF
|
||||
#ifdef snprintf
|
||||
#undef snprintf
|
||||
#endif
|
||||
@ -138,7 +134,6 @@ typedef int Py_ssize_t;
|
||||
#define vsnprintf pg_vsnprintf
|
||||
#define snprintf pg_snprintf
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* USE_REPL_SNPRINTF */
|
||||
|
||||
/*
|
||||
* Used throughout, and also by the Python 2/3 porting layer, so it's easier to
|
||||
|
Reference in New Issue
Block a user