2009-11-26 22:26 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/vm/garbage.c
    % small improvement in HB_GC_AUTO code

  * harbour/include/hbdefs.h
    ! reverted the hack which casted file handles to unsigned values
      I added two weeks ago - it was also converting FS_ERROR value
      from -1 to 4294967295. Please remember that on some platforms
      negative handles can exist and are valid. Only -1 indicates an
      error.

  * harbour/utils/hbtest/rt_file.prg
    + added regression test for FOPEN() FS_ERROR value

  * harbour/contrib/hbwin/legacycd.c
  * harbour/contrib/hbwin/legacyco.c
    * added missing EOL at EOF
This commit is contained in:
Przemyslaw Czerpak
2009-11-26 21:26:13 +00:00
parent 5eb592acd3
commit 5ba8b665f3
6 changed files with 34 additions and 8 deletions

View File

@@ -17,6 +17,24 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-26 22:26 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/vm/garbage.c
% small improvement in HB_GC_AUTO code
* harbour/include/hbdefs.h
! reverted the hack which casted file handles to unsigned values
I added two weeks ago - it was also converting FS_ERROR value
from -1 to 4294967295. Please remember that on some platforms
negative handles can exist and are valid. Only -1 indicates an
error.
* harbour/utils/hbtest/rt_file.prg
+ added regression test for FOPEN() FS_ERROR value
* harbour/contrib/hbwin/legacycd.c
* harbour/contrib/hbwin/legacyco.c
* added missing EOL at EOF
2009-11-26 09:34 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
- contrib/hbide/resources/tabmodified.PNG
* contrib/xhb/Makefile

View File

@@ -76,4 +76,4 @@ HB_FUNC( SETLASTERROR )
SetLastError( hb_parnl( 1 ) );
}
#endif
#endif

View File

@@ -123,4 +123,4 @@ HB_FUNC( __OLEPDISP )
( IDispatch * ) ( HB_PTRUINT ) hb_parnint( 1 ) );
}
#endif
#endif

View File

@@ -612,7 +612,7 @@ typedef unsigned long HB_COUNTER;
#else
typedef void * HB_FHANDLE;
#endif
typedef HB_PTRUINT HB_NHANDLE;
typedef HB_PTRDIFF HB_NHANDLE;
# define hb_numToHandle( h ) ( ( HB_FHANDLE ) ( HB_NHANDLE ) ( h ) )
#else
typedef int HB_FHANDLE;

View File

@@ -131,10 +131,15 @@ typedef struct HB_GARBAGE_
#define HB_GC_DELETELST 4 /* item will be deleted during finalization */
#ifdef HB_GC_AUTO
#define HB_GC_AUTO_CHECK 100000
#define HB_GC_AUTO_MAX ( ( HB_PTRUINT ) ( -1 ) );
/* number of allocated memory blocks */
static ULONG s_ulBlocks = 0;
static HB_PTRUINT s_ulBlocks = 0;
/* number of allocated memory blocks after last GC activation */
static ULONG s_ulBlocksMarked = 0;
static HB_PTRUINT s_ulBlocksMarked = 0;
/* number of allocated memory blocks which should force next GC activation */
static HB_PTRUINT s_ulBlocksCheck = HB_GC_AUTO_CHECK;
# define HB_GC_AUTO_INC ++s_ulBlocks;
# define HB_GC_AUTO_DEC --s_ulBlocks;
#else
@@ -202,7 +207,7 @@ void * hb_gcAllocate( ULONG ulSize, const HB_GC_FUNCS * pFuncs )
pAlloc->used = s_uUsedFlag;
HB_GC_LOCK
#ifdef HB_GC_AUTO
if( s_ulBlocks > s_ulBlocksMarked + 100000 )
if( s_ulBlocks > s_ulBlocksCheck )
{
HB_GC_UNLOCK
hb_gcCollectAll( TRUE );
@@ -233,7 +238,7 @@ void * hb_gcAllocRaw( ULONG ulSize, const HB_GC_FUNCS * pFuncs )
HB_GC_LOCK
#ifdef HB_GC_AUTO
if( s_ulBlocks > s_ulBlocksMarked + 100000 )
if( s_ulBlocks > s_ulBlocksCheck )
{
HB_GC_UNLOCK
hb_gcCollectAll( TRUE );
@@ -703,9 +708,11 @@ void hb_gcCollectAll( BOOL fForce )
#ifdef HB_GC_AUTO
/* store number of marked blocks for automatic GC activation */
s_ulBlocksMarked = s_ulBlocks;
s_ulBlocksCheck = s_ulBlocksMarked + HB_GC_AUTO_CHECK;
if( s_ulBlocksCheck <= s_ulBlocksMarked )
s_ulBlocksCheck = HB_GC_AUTO_MAX;
#endif
/* call memory manager cleanup function */
hb_xclean();

View File

@@ -137,6 +137,7 @@ PROCEDURE Main_FILE()
TEST_LINE( TESTFIER( FErase( 1 ) ) , 'E: 3 R: -1' )
TEST_LINE( TESTFIER( FErase( "NOT_HERE.$$$" ) ) , 'E: 2 R: -1' )
TEST_LINE( TESTFIER( FRename( "NOT_HERE.$$$", 'A' ) ) , 'E: 2 R: -1' )
TEST_LINE( TESTFIER( FOpen( "NOT_HERE.$$$" ) ) , 'E: 2 R: -1' )
nFlags := FO_READWRITE
fhnd := FOpen( cFileName, nFlags )