Revert workarounds for unportability of printf %.*s format?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Revert workarounds for unportability of printf %.*s format?
Date: 2020-06-28 19:48:04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

In connection with the discussion at [1], I realized that we could unwind
the hacks we've introduced --- mostly in commit 54cd4f045 --- to avoid
depending on the behavior of %.*s format in printf. Now that we always
use our own snprintf.c code, we know that it measures field widths in
bytes not characters, and we also know that use of this format won't
cause random encoding-related failures.

Some of the changes are not worth undoing; for example using strlcpy
instead of snprintf to truncate a string is a net win by any measure.
But places where we introduced a temporary buffer, such as the
change in truncate_identifier() in 54cd4f045, would be better off
with the old coding. In any case we could remove all the comments
warning against using this feature.


regards, tom lane


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-06-28 22:00:16 Re: pg_read_file() with virtual files returns empty string
Previous Message Magnus Hagander 2020-06-28 18:50:20 Re: Commitfest 2020-07