Re: Reasons not to like asprintf - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Reasons not to like asprintf
Date
Msg-id 20131022175651.GZ2706@tamriel.snowman.net
Whole thread Raw
In response to Reasons not to like asprintf  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Reasons not to like asprintf
List pgsql-hackers
Tom,

* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> In short, I want to change pg_asprintf to return the malloc'd buffer
> as its function result.  This probably means we should change the
> function name too, since the allusion to asprintf is completely useless
> if we do that.  I'm thinking pg_psprintf for the frontend version of
> psprintf, but maybe somebody has a better suggestion?

Sounds reasonable, and I haven't got a better name, but I'm trying to
figure out why psprintf hasn't got the same issues which you mention in
your other thread (eg: depending on vsnprintf to return the "would-be"
result size).  I'm also a bit nervous that we only check vsnprintf()
success in Assert-enabled builds in psprintf, though I suppose that's
all we're doing in appendStringInfo too.
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Failure while inserting parent tuple to B-tree is not fun
Next
From: Robert Haas
Date:
Subject: Re: logical changeset generation v6.2