Re: [HACKERS] StringInfo misc. issues

2007-08-29 Thread NikhilS
Apologies! As Alvaro guessed it correctly I was working with 8.2 sources.
Sorry for the noise.

Regards,
Nikhils

On 8/29/07, Tom Lane <[EMAIL PROTECTED]> wrote:
>
> NikhilS <[EMAIL PROTECTED]> writes:
> > The attached patch should fix this.
>
> And break other things, no doubt.  needed = 0 is a perfectly valid
> edge case and mustn't be rejected here.  (In fact, I doubt you'd
> even get through the regression tests with this patch ... how much
> did you test it?)
>
> The real problem with what you describe is that you should have used
> makeStringInfo().
>
> > I also found the absence of a function like resetStringInfo() a bit
> > puzzling.
>
> CVS HEAD is way ahead of you.
>
> regards, tom lane
>



-- 
EnterpriseDB   http://www.enterprisedb.com


Re: [HACKERS] StringInfo misc. issues

2007-08-29 Thread Tom Lane
NikhilS <[EMAIL PROTECTED]> writes:
> The attached patch should fix this.

And break other things, no doubt.  needed = 0 is a perfectly valid
edge case and mustn't be rejected here.  (In fact, I doubt you'd
even get through the regression tests with this patch ... how much
did you test it?)

The real problem with what you describe is that you should have used
makeStringInfo().

> I also found the absence of a function like resetStringInfo() a bit
> puzzling.

CVS HEAD is way ahead of you.

regards, tom lane

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Re: [HACKERS] StringInfo misc. issues

2007-08-29 Thread Alvaro Herrera
Andrew Dunstan escribió:
>
>
> NikhilS wrote:
>>
>>
>> I also found the absence of a function like resetStringInfo() a bit 
>> puzzling. A found a lot of places where the code was resetting the "len" 
>> field to 0 and assigning '\0' to the data field to reset the variable. 
>> This seems to be the only missing API which will be needed while working 
>> with the StringInfo type.
>
>
> er, what? stringinfo.h has:
>
> /*
> * resetStringInfo
> * Clears the current content of the StringInfo, if any. The
> * StringInfo remains valid.
> */
> extern void resetStringInfo(StringInfo str);

I think Neil added this recently.  Maybe NikhilS is looking at 8.2 or
something.

-- 
Alvaro Herrera  Developer, http://www.PostgreSQL.org/
"The Gord often wonders why people threaten never to come back after they've
been told never to return" (www.actsofgord.com)

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] StringInfo misc. issues

2007-08-29 Thread Andrew Dunstan



NikhilS wrote:



I also found the absence of a function like resetStringInfo() a bit 
puzzling. A found a lot of places where the code was resetting the 
"len" field to 0 and assigning '\0' to the data field to reset the 
variable. This seems to be the only missing API which will be needed 
while working with the StringInfo type.



er, what? stringinfo.h has:

/*
* resetStringInfo
* Clears the current content of the StringInfo, if any. The
* StringInfo remains valid.
*/
extern void resetStringInfo(StringInfo str);


cheers

andrew




cheers

andrew

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