On 2022-Nov-13, Peter Eisentraut wrote:
> On 09.11.22 13:29, Alvaro Herrera wrote:
> > > + /* Loop in case we have to retry after enlarging the buffer. */
> > > + do
> > > + {
> > > + errno = save_errno;
> > > + va_start(args, fmt);
> > > + done = appendPQExpBufferVA(errorMessage, libpq_gettext(fmt), args);
> >
> > I wonder if it makes sense to do libpq_gettext() just once, instead of
> > redoing it on each iteration.
>
> I wonder whether that would expose us to potential compiler warnings about
> the format string not being constant. As long as the compiler can trace
> that the string comes from gettext, it knows what's going on.
>
> Also, most error strings in practice don't need the loop, so maybe it's not
> a big issue.
True.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/