2006-07-11 14:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/estack.c
    * minor optimizations

  * harbour/source/vm/itemapi.c
    * make hb_itemClear() safe for not allocated stack items
This commit is contained in:
Przemyslaw Czerpak
2006-07-11 12:21:22 +00:00
parent a3b9985f5e
commit 61321e4739
3 changed files with 28 additions and 4 deletions

View File

@@ -8,6 +8,13 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* doc/en/rddmisc.txt
* doc/en/rdddb.txt
! Fix the sample for AFIELDS()
* Mark AFIELDS() as obsolete
2006-07-11 14:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/estack.c
* minor optimizations
* harbour/source/vm/itemapi.c

View File

@@ -221,8 +221,13 @@ void hb_stackInit( void )
void hb_stackRemove( LONG lUntilPos )
{
HB_ITEM_PTR * pEnd = hb_stack.pItems + lUntilPos;
while( hb_stack.pPos > pEnd )
hb_stackPop();
{
--hb_stack.pPos;
if( HB_IS_COMPLEX( * hb_stack.pPos ) )
hb_itemClear( * hb_stack.pPos );
}
}
HB_ITEM_PTR hb_stackNewFrame( HB_STACK_STATE * pStack, USHORT uiParams )
@@ -251,7 +256,11 @@ HB_ITEM_PTR hb_stackNewFrame( HB_STACK_STATE * pStack, USHORT uiParams )
void hb_stackOldFrame( HB_STACK_STATE * pStack )
{
while( hb_stack.pPos > hb_stack.pBase )
hb_stackPop();
{
--hb_stack.pPos;
if( HB_IS_COMPLEX( * hb_stack.pPos ) )
hb_itemClear( * hb_stack.pPos );
}
hb_stack.pBase = hb_stack.pItems + pStack->lBaseItem;
hb_stack.iStatics = pStack->iStatics;

View File

@@ -1274,9 +1274,17 @@ HB_EXPORT void hb_itemClear( PHB_ITEM pItem )
}
else if( HB_IS_ENUM( pItem ) ) /* FOR EACH control variable */
{
/*
* pItem->item.asEnum.valuePtr is intentionally assigned to pValue to
* avoid possible problems when pItem is stack item just freed which
* can be overwritten if hb_itemRelease( pItem->item.asEnum.basePtr )
* activate .prg destructor [druzus]
*/
PHB_ITEM pValue = pItem->item.asEnum.valuePtr;
hb_itemRelease( pItem->item.asEnum.basePtr );
if( pItem->item.asEnum.valuePtr )
hb_itemRelease( pItem->item.asEnum.valuePtr );
if( pValue )
hb_itemRelease( pValue );
}
#if defined( HB_FM_STATISTICS ) && defined( HB_PARANOID_MEM_CHECK )