Re: [PATCH] Add use of asprintf()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [PATCH] Add use of asprintf()
Дата
Msg-id 20130916203137.GB4991@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на [PATCH] Add use of asprintf()  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: [PATCH] Add use of asprintf()  (Asif Naeem <anaeem.it@gmail.com>)
Re: [PATCH] Add use of asprintf()  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: Updatable view columns
Следующее
От: Yeb Havinga
Дата:
Сообщение: Re: Possible memory leak with SQL function?