Peter Eisentraut wrote:

> The attached patch should speak for itself.

Yeah, it's a very nice cleanup.

> I have supplied a few variants:
> 
> - asprintf() is the standard function, supplied by libpgport if
> necessary.
> 
> - pg_asprintf() is asprintf() with automatic error handling (like
> pg_malloc(), etc.)
> 
> - psprintf() is the same idea but with palloc.

Looks good to me, except that pg_asprintf seems to be checking ret
instead of rc.

Is there a reason for the API discrepancy of pg_asprintf vs. psprintf?
I don't see that we use the integer return value anywhere.  Callers
interested in the return value can use asprintf directly (and you have
already inserted callers that do nonstandard things using direct
asprintf).

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to