2013-06-05 15:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/vm/hashes.c
    ! remove index when natural order is disabled by
         hb_hKeepOrder( hVal, .f. )
    ! do not update index when item is deleted and hash array
      is marked to be resorted
    % few minor optimizations

  * contrib/sddoci/sddoci.hbc
    * use ocilib as library name in Linux builds.
    ; I do not know on which platforms ocilib[wma] is used but it's
      possible that this modification should be done also for other
      platforms not only for Linux.
This commit is contained in:
Przemysław Czerpak
2013-06-05 15:54:01 +02:00
parent ad65425d8a
commit 2a22103f05
3 changed files with 32 additions and 11 deletions

View File

@@ -10,6 +10,20 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-06-05 15:54 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/vm/hashes.c
! remove index when natural order is disabled by
hb_hKeepOrder( hVal, .f. )
! do not update index when item is deleted and hash array
is marked to be resorted
% few minor optimizations
* contrib/sddoci/sddoci.hbc
* use ocilib as library name in Linux builds.
; I do not know on which platforms ocilib[wma] is used but it's
possible that this modification should be done also for other
platforms not only for Linux.
2013-06-05 11:01 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/hbgtcore.c
! fix for recent modification

View File

@@ -4,6 +4,7 @@ description=RDDSQL OCILib (Oracle SQL) backend
libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}
{HB_WITH_OCILIB_WIDE}libs=ocilibw
{HB_WITH_OCILIB_MIXED}libs=ocilibm
{!HB_WITH_OCILIB_WIDE&!HB_WITH_OCILIB_MIXED}libs=ociliba
{!HB_WITH_OCILIB_WIDE&!HB_WITH_OCILIB_MIXED&linux}libs=ocilib
{!HB_WITH_OCILIB_WIDE&!HB_WITH_OCILIB_MIXED&!linux}libs=ociliba
libs=rddsql.hbc

View File

@@ -229,15 +229,17 @@ static void hb_hashSortDo( PHB_BASEHASH pBaseHash )
if( pBaseHash->pnPos )
{
HB_SIZE * pnPos = pBaseHash->pnPos;
for( nFrom = 1; nFrom < pBaseHash->nLen; ++nFrom )
{
PHB_ITEM pKey = &pBaseHash->pPairs[ pBaseHash->pnPos[ nFrom ] ].key;
PHB_ITEM pKey = &pBaseHash->pPairs[ pnPos[ nFrom ] ].key;
HB_SIZE nLeft = 0, nRight = nFrom;
while( nLeft < nRight )
{
HB_SIZE nMiddle = ( nLeft + nRight ) >> 1;
int i = hb_hashItemCmp( &pBaseHash->pPairs[ pBaseHash->pnPos[ nMiddle ] ].key,
int i = hb_hashItemCmp( &pBaseHash->pPairs[ pnPos[ nMiddle ] ].key,
pKey, iFlags );
if( i > 0 )
nRight = nMiddle;
@@ -246,10 +248,11 @@ static void hb_hashSortDo( PHB_BASEHASH pBaseHash )
}
if( nLeft < nFrom )
{
nRight = pBaseHash->pnPos[ nLeft ];
memmove( pBaseHash->pnPos + nLeft, pBaseHash->pnPos + nLeft + 1,
( nFrom - nLeft ) * sizeof( HB_SIZE ) );
pBaseHash->pnPos[ nFrom ] = nRight;
nRight = pnPos[ nLeft ];
do
pnPos[ nLeft ] = pnPos[ nLeft + 1 ];
while( ++nLeft < nFrom );
pnPos[ nFrom ] = nRight;
}
}
}
@@ -386,8 +389,9 @@ static PHB_ITEM hb_hashValuePtr( PHB_BASEHASH pBaseHash, PHB_ITEM pKey, HB_BOOL
pBaseHash->pPairs[ nPos ].key.type = HB_IT_NIL;
pBaseHash->pPairs[ nPos ].value.type = HB_IT_NIL;
}
hb_itemCopy( &pBaseHash->pPairs[ nPos ].key, pKey );
pBaseHash->nLen++;
hb_itemCopy( &pBaseHash->pPairs[ nPos ].key, pKey );
if( pBaseHash->pDefault )
hb_itemCloneTo( &pBaseHash->pPairs[ nPos ].value, pBaseHash->pDefault );
}
@@ -418,9 +422,9 @@ static HB_BOOL hb_hashNewValue( PHB_BASEHASH pBaseHash, PHB_ITEM pKey, PHB_ITEM
pBaseHash->pPairs[ nPos ].value.type = HB_IT_NIL;
}
pBaseHash->nLen++;
hb_itemCopy( &pBaseHash->pPairs[ nPos ].key, pKey );
hb_itemCopyFromRef( &pBaseHash->pPairs[ nPos ].value, pValue );
pBaseHash->nLen++;
return HB_TRUE;
}
@@ -462,7 +466,7 @@ static void hb_hashDelPair( PHB_BASEHASH pBaseHash, HB_SIZE nPos )
}
else
{
if( pBaseHash->pnPos )
if( pBaseHash->pnPos && ( pBaseHash->iFlags & HB_HASH_RESORT ) == 0 )
{
#ifdef HB_FAST_HASH_DEL
HB_SIZE * pnPos, * pnDel, * pnLast;
@@ -1161,7 +1165,7 @@ void hb_hashSetFlags( PHB_ITEM pHash, int iFlags )
HB_SIZE n = pHash->item.asHash.value->nSize;
pHash->item.asHash.value->pnPos = ( HB_SIZE * )
hb_xgrab( pHash->item.asHash.value->nSize * sizeof( HB_SIZE ) );
hb_xgrab( n * sizeof( HB_SIZE ) );
do
{
--n;
@@ -1183,6 +1187,8 @@ void hb_hashClearFlags( PHB_ITEM pHash, int iFlags )
( pHash->item.asHash.value->iFlags & HB_HASH_KEEPORDER ) == 0 )
{
hb_hashResort( pHash->item.asHash.value );
hb_xfree( pHash->item.asHash.value->pnPos );
pHash->item.asHash.value->pnPos = NULL;
}
}
}