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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Revert workarounds for unportability of printf %.*s format?
Дата
Msg-id 279428.1593373684@sss.pgh.pa.us
обсуждение исходный текст
Список 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.

Thoughts?

            regards, tom lane

[1] https://www.postgresql.org/message-id/flat/a120087c-4c88-d9d4-1ec5-808d7a7f133d%40gmail.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Commitfest 2020-07
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_read_file() with virtual files returns empty string