Re: resetStringInfo

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: resetStringInfo
Date: 2007-03-03 16:23:09
Message-ID: 200703031623.l23GN9K26551@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Are there any places in our code where we could use it? If so, please
add that to the patch.

---------------------------------------------------------------------------

Neil Conway wrote:
> 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
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Joshua D. Drake 2007-03-03 17:09:47 Re: POSIX shared memory support
Previous Message Andrew Dunstan 2007-03-03 14:06:11 Re: Arrays of Complex Types