Re: Reasons not to like asprintf

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Reasons not to like asprintf
Date: 2013-10-22 17:56:52
Message-ID: 20131022175651.GZ2706@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-10-22 17:57:53 Re: logical changeset generation v6.2
Previous Message Peter Geoghegan 2013-10-22 17:45:27 Re: Failure while inserting parent tuple to B-tree is not fun