Hi Maurilio,

> Viktor,
> 
> pw := Space( Len( pw ) )
> 
> could do it?
> 
> And a
> 
> pw := Stuff( pw, 1, Len( pw ), Space( Len( pw ) ) )
> 
> Given that the string has same lenght shouldn't it reuse allocated memory?

These were my two first thoughts, but internally 
I think they both just create new string and may 
leave old buffer content around in an unreleased 
block.

Maybe we will need some dedicated function to do 
this, using hb_itemGetWriteCL():

---
HB_FUNC( HB_STRCLEAR )
{
   PHB_ITEM pBuffer = hb_param( 1, HB_IT_STRING );

   if( pBuffer && HB_ISBYREF( 1 ) )
   {
      char * buffer;
      HB_SIZE nSize;

      if( hb_itemGetWriteCL( pBuffer, &buffer, &nSize ) )
         memset( buffer, '\0', nSize + 1 );
   }
}
---

Then call with:
   HB_STRCLEAR( @cPassword )

Does that look okay?

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to