From a30828ee08830e345c7f187a96c10ab9abae90bc Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 21 Dec 2009 22:29:58 +0000 Subject: [PATCH] 2009-12-21 23:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/src/vm/garbage.c - removed function hb_gcRefDec() * functions hb_gcRefInc() and hb_gcRefFree() moved to public API After recent modifications in GC which introduced user defined mark functions it's reasonable to make these function public to extend functionality and give GC full interface to user defined blocks. --- harbour/ChangeLog | 10 ++++++++++ harbour/include/hbapi.h | 6 ++---- harbour/src/vm/garbage.c | 7 ------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bb8409d872..101c9de931 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-21 23:29 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbapi.h + * harbour/src/vm/garbage.c + - removed function hb_gcRefDec() + * functions hb_gcRefInc() and hb_gcRefFree() moved to public API + After recent modifications in GC which introduced user defined + mark functions it's reasonable to make these function public to + extend functionality and give GC full interface to user defined + blocks. + 2009-12-21 23:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/rddsql/hbrddsql.h * harbour/contrib/rddsql/sqlbase.c diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 4cce18b11e..d0ca3bc4d7 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -583,6 +583,8 @@ extern HB_EXPORT void hb_gcFree( void * pAlloc ); /* deallocates a memory a extern HB_EXPORT void * hb_gcLock( void * pAlloc ); /* do not release passed memory block */ extern HB_EXPORT void * hb_gcUnlock( void * pAlloc ); /* passed block is allowed to be released */ extern HB_EXPORT void hb_gcMark( void * pAlloc ); /* mark given block as used */ +extern HB_EXPORT void hb_gcRefInc( void * pAlloc ); /* increment reference counter */ +extern HB_EXPORT void hb_gcRefFree( void * pAlloc ); /* decrement reference counter and free the block when 0 reached */ extern HB_EXPORT void hb_gcDummyMark( void * Cargo ); /* dummy GC mark function */ @@ -604,14 +606,10 @@ extern void hb_vmIsStaticRef( void ); /* hvm.c - mark all static variables extern void hb_gcReleaseAll( void ); /* release all memory blocks unconditionally */ extern void hb_gcRefCheck( void * pBlock ); /* Check if block still cannot be access after destructor execution */ -extern void hb_gcRefInc( void * pAlloc ); /* increment reference counter */ -extern BOOL hb_gcRefDec( void * pAlloc ); /* decrement reference counter, return HB_TRUE when 0 reached */ -extern void hb_gcRefFree( void * pAlloc ); /* decrement reference counter and free the block when 0 reached */ extern HB_COUNTER hb_gcRefCount( void * pAlloc ); /* return number of references */ #if 0 #define hb_gcRefInc( p ) hb_xRefInc( HB_GC_PTR( p ) ) -#define hb_gcRefDec( p ) hb_xRefDec( HB_GC_PTR( p ) ) #define hb_gcRefCount( p ) hb_xRefCount( HB_GC_PTR( p ) ) #define hb_gcFunc( p ) ( HB_GC_PTR( p )->pFunc ) #endif diff --git a/harbour/src/vm/garbage.c b/harbour/src/vm/garbage.c index 377b2a7485..c63ca1c2a5 100644 --- a/harbour/src/vm/garbage.c +++ b/harbour/src/vm/garbage.c @@ -298,13 +298,6 @@ void hb_gcRefInc( void * pBlock ) hb_xRefInc( HB_GC_PTR( pBlock ) ); } -/* decrement reference counter, return TRUE when 0 reached */ -#undef hb_gcRefDec -BOOL hb_gcRefDec( void * pBlock ) -{ - return hb_xRefDec( HB_GC_PTR( pBlock ) ); -} - /* decrement reference counter and free the block when 0 reached */ #undef hb_gcRefFree void hb_gcRefFree( void * pBlock )