Convert DCH_to_char() to use a StringInfo as destination. Formerly, we allocated an output char array with 12 bytes per byte of the format string. That's usually far more than enough, and yet we had to add assorted code to defend against cases where it isn't enough. Switch to using a StringInfo expansible buffer instead. This is considerably more robust, shortens the code noticeably, and eliminates various edge-case failure conditions.
While at it, const-ify some parameters that can be const. Author: Tom Lane <[email protected]> Reviewed-by: Heikki Linnakangas <[email protected]> Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/03d2554638cb5c95819e1e720e15672630a3cbdd Modified Files -------------- src/backend/utils/adt/formatting.c | 561 ++++++++++++++----------------------- 1 file changed, 205 insertions(+), 356 deletions(-)
