Re: C99 compliance for src/port/snprintf.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: C99 compliance for src/port/snprintf.c
Date: 2018-08-16 00:15:58
Message-ID: 2886.1534378558@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

I wrote:
> BTW, independently of whether to back-patch, it strikes me that what
> we ought to do in HEAD (after applying this) is to just assume we have
> C99-compliant behavior, and rip out the baroque logic in psnprintf
> and appendPQExpBufferVA that tries to deal with pre-C99 snprintf.

Here's a proposed patch for that. It also gets rid of some ancient
code that tried to deal with snprintfs that were outright broken,
such as writing past the end of the specified buffer. Even if anyone
is still using platforms where that's a problem, I'd expect that we'd
have rejected the system snprintf thanks to configure's feature checks.

regards, tom lane

Attachment Content-Type Size
assume-snprintf-follows-c99.patch text/x-diff 15.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-08-16 00:24:47 Re: C99 compliance for src/port/snprintf.c
Previous Message Michael Paquier 2018-08-16 00:14:24 Re: Documentaion fix.

Browse pgsql-www by date

  From Date Subject
Next Message Thomas Munro 2018-08-16 00:24:47 Re: C99 compliance for src/port/snprintf.c
Previous Message Andres Freund 2018-08-15 23:06:13 Re: C99 compliance for src/port/snprintf.c