Re: Using the %m printf format more

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Using the %m printf format more
Дата
Msg-id Ze6lBpOSHMANU6fq@paquier.xyz
обсуждение исходный текст
Ответ на Using the %m printf format more  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
Ответы Re: Using the %m printf format more  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
Список pgsql-hackers
On Wed, Mar 06, 2024 at 07:11:19PM +0000, Dagfinn Ilmari Mannsåker wrote:
> I just noticed that commit d93627bc added a bunch of pg_fatal() calls
> using %s and strerror(errno), which could be written more concisely as
> %m.  I'm assuming this was done because the surrounding code also uses
> this pattern, and hadn't been changed to use %m when support for that
> was added to snprintf.c to avoid backporting hazards.  However, that
> support was in v12, which is now the oldest still-supported back branch,
> so we can safely make that change.

Right.  This may still create some spurious conflicts, but that's
manageable for error strings.  The changes in your patch look OK.

> The attached patch does so everywhere appropriate. One place where it's
> not appropriate is the TAP-emitting functions in pg_regress, since those
> call fprintf()

I am not really following your argument with pg_regress.c and
fprintf().  d6c55de1f99a should make that possible even in the case of
emit_tap_output_v(), no?

> and other potentially errno-modifying functions before
> evaluating the format string.

Sure.
--
Michael

Вложения

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Schema variables - new implementation for Postgres 15
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: WIP Incremental JSON Parser