Re: Why the asprintf patch is still breaking the buildfarm - Mailing list pgsql-hackers

From David Rowley
Subject Re: Why the asprintf patch is still breaking the buildfarm
Date
Msg-id CAApHDvqNVSc=DYYuvt13YyHmrhCvYH4wb_o6Ha1Gz+sCAvUdKA@mail.gmail.com
Whole thread Raw
In response to Re: Why the asprintf patch is still breaking the buildfarm  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why the asprintf patch is still breaking the buildfarm  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Oct 23, 2013 at 4:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Yeah.  As a separate matter, it might be useful to revise stringinfo.c
and the asprintf code so that *if* the returned value is larger than the
given buffer size, we use it as a guide to resizing, avoiding the possible
need to loop multiple times to make the buffer large enough.  And we could
also improve our own implementation of snprintf to follow the C99 spec.


Attached is a draft patch which implements this. 
I didn't bother making the translation macros make use of the extra data as I
didn't think we would have many translations long enough to take advantage of it.

I think it's a good idea to take advantage of the buffer size if vsnprintf() has gone
to the trouble of working out what is needed for us. It seems quite wasteful to throw this information away.

Comments are welcome.

Regards

David

Attachment

pgsql-hackers by date:

Previous
From: Samrat Revagade
Date:
Subject: Re: Review of pg_rewind
Next
From: Heikki Linnakangas
Date:
Subject: Re: all_visible replay aborting due to uninitialized pages