2006-09-06 14:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/itemapi.c
    * modified hb_itemClear() to be reentrant safe - the new version
      can be also better optimized by C compiler so should be also faster

  * harbour/source/rdd/dbcmd.c
    ! initialize lpdbOrdCondInfo in DBORDERINFO structure before
      passing to ORDCREATE()

  * harbour/source/vm/fm.c
    ! fixed typo in memset() when HB_PARANOID_MEM_CHECK enabled

  * harbour/source/vm/hvm.c
    ! fixed item type used for iterator
This commit is contained in:
Przemyslaw Czerpak
2006-09-06 12:50:46 +00:00
parent ddbcddbd00
commit 95732edd48
5 changed files with 36 additions and 20 deletions

View File

@@ -8,6 +8,21 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
! generate internal error if ErrorNew() function does not return an object
2006-09-07 16:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/memvars.c
! fixed memvar creation in __MVPUT()
2006-09-07 01:55 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rdd/dbcmd.c
! always initialize all members in RDD structures to avoid GPF when
some RDD will try to access uninitialized data
* harbour/source/rdd/usrrdd/usrrdd.c
! added some additional validation in RDD structures <-> item conversions
2006-09-06 14:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/itemapi.c
* modified hb_itemClear() to be reentrant safe - the new version
can be also better optimized by C compiler so should be also faster

View File

@@ -2877,6 +2877,8 @@ HB_FUNC( ORDCREATE )
dbOrderInfo.lpdbConstraintInfo = NULL;
}
dbOrderInfo.lpdbOrdCondInfo = pArea->lpdbOrdCondInfo;
SELF_ORDCREATE( pArea, &dbOrderInfo );
}
else

View File

@@ -320,7 +320,7 @@ HB_EXPORT void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates m
if( ulSize > ulMemSize )
{
memcpy( pMem, pMemBlock, HB_ALLOC_SIZE( ulMemSize ) );
memset( ( BYTE * ) pMem + HB_ALLOC_SIZE( ulMemSize ), ulSize - ulMemSize );
memset( ( BYTE * ) pMem + HB_ALLOC_SIZE( ulMemSize ), HB_MEMFILER, ulSize - ulMemSize );
}
else
memcpy( pMem, pMemBlock, HB_ALLOC_SIZE( ulSize ) );

View File

@@ -3120,7 +3120,7 @@ static void hb_vmEnumStart( BYTE nVars, BYTE nDescend )
}
}
hb_vmPushLong( nVars ); /* number of iterators */
hb_vmPushInteger( nVars ); /* number of iterators */
/* empty array/string - do not start enumerations loop */
hb_vmPushLogical( ulMax != 0 );
}
@@ -3137,7 +3137,7 @@ static void hb_vmEnumNext( void )
HB_ITEM_PTR pEnum;
int i;
for( i = ( int ) hb_stackItemFromTop( -1 )->item.asLong.value; i > 0; --i )
for( i = ( int ) hb_stackItemFromTop( -1 )->item.asInteger.value; i > 0; --i )
{
pEnum = hb_itemUnRefOnce( hb_stackItemFromTop( -( i << 1 ) ) );
if( HB_IS_ARRAY( pEnum->item.asEnum.basePtr ) )
@@ -3175,7 +3175,7 @@ static void hb_vmEnumPrev( void )
HB_ITEM_PTR pEnum;
int i;
for( i = hb_stackItemFromTop( -1 )->item.asLong.value; i > 0; --i )
for( i = hb_stackItemFromTop( -1 )->item.asInteger.value; i > 0; --i )
{
pEnum = hb_itemUnRefOnce( hb_stackItemFromTop( -( i << 1 ) ) );
if( HB_IS_ARRAY( pEnum->item.asEnum.basePtr ) )
@@ -3208,13 +3208,13 @@ static void hb_vmEnumPrev( void )
*/
static void hb_vmEnumEnd( void )
{
LONG lVars;
int iVars;
/* remove number of iterators */
lVars = hb_stackItemFromTop( -1 )->item.asLong.value;
iVars = hb_stackItemFromTop( -1 )->item.asInteger.value;
hb_stackDec();
while( --lVars >= 0 )
while( --iVars >= 0 )
{
hb_stackPop();
hb_stackPop();

View File

@@ -1253,28 +1253,33 @@ HB_EXPORT void hb_itemInit( PHB_ITEM pItem )
HB_EXPORT void hb_itemClear( PHB_ITEM pItem )
{
HB_TYPE type;
HB_TRACE(HB_TR_DEBUG, ("hb_itemClear(%p)", pItem));
if( HB_IS_STRING( pItem ) )
type = pItem->type;
pItem->type = HB_IT_NIL;
if( type & HB_IT_STRING )
{
if( pItem->item.asString.allocated )
hb_xRefFree( pItem->item.asString.value );
}
else if( HB_IS_ARRAY( pItem ) )
else if( type & HB_IT_ARRAY )
hb_gcRefFree( pItem->item.asArray.value );
else if( HB_IS_BLOCK( pItem ) )
else if( type & HB_IT_BLOCK )
hb_gcRefFree( pItem->item.asBlock.value );
else if( HB_IS_MEMVAR( pItem ) )
else if( type & HB_IT_MEMVAR )
hb_memvarValueDecRef( pItem->item.asMemvar.value );
else if( HB_IS_POINTER( pItem ) )
else if( type & HB_IT_POINTER )
{
if( pItem->item.asPointer.collect )
hb_gcRefFree( pItem->item.asPointer.value );
}
else if( HB_IS_ENUM( pItem ) ) /* FOR EACH control variable */
else if( type & HB_IT_ENUM ) /* FOR EACH control variable */
{
/*
* pItem->item.asEnum.valuePtr is intentionally assigned to pValue to
@@ -1284,17 +1289,11 @@ HB_EXPORT void hb_itemClear( PHB_ITEM pItem )
*/
PHB_ITEM pValue = pItem->item.asEnum.valuePtr;
pItem->type = HB_IT_NIL;
hb_itemRelease( pItem->item.asEnum.basePtr );
if( pValue )
hb_itemRelease( pValue );
}
#if defined( HB_FM_STATISTICS ) && defined( HB_PARANOID_MEM_CHECK )
else if( HB_IS_BADITEM( pItem ) )
hb_errInternal( HB_EI_VMPOPINVITEM, NULL, "hb_itemClear()", NULL );
#endif
pItem->type = HB_IT_NIL;
}
/* Internal API, not standard Clipper */