resetStringInfo

Поиск
Список
Период
Сортировка
От Neil Conway
Тема resetStringInfo
Дата
Msg-id 1172905226.6571.29.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: resetStringInfo  (Bruce Momjian <bruce@momjian.us>)
Re: resetStringInfo  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Attached is a patch that makes a minor addition to the StringInfo API:
resetStringInfo(), which clears the current content of the StringInfo
but leaves it valid for future operations.

I needed this for an external project, but ISTM this would be worth
including in mainline: I'd imagine it's a fairly common operation, and
there's no easy way to do it at the moment. Clients can manually reset
the StringInfo's fields, but that is poor interface design, as well as
being error-prone: many people might just reset "len" and forget to
NUL-terminate the data buffer and reset the cursor. initStringInfo()
could be used, but it reallocates the StringInfo's data buffer, which is
often undesirable.

-Neil


Вложения

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

Предыдущее
От: Chris Marcellino
Дата:
Сообщение: Re: POSIX shared memory support
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: resetStringInfo