From aae5c40c3ae4f19d87fa30c3ae43ad88e536ba2f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 13 Mar 2007 22:35:22 +0000 Subject: [PATCH] 2007-03-13 23:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/pp/pplib.c ! fixed std rules initialization - now it should also use GC pointer item or __PP_STDRULES will ignore it --- harbour/ChangeLog | 5 +++++ harbour/source/pp/pplib.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fc88733136..de3f03a6f2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-03-13 23:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/pp/pplib.c + ! fixed std rules initialization - now it should also use GC pointer + item or __PP_STDRULES will ignore it + 2007-03-13 19:40 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/include/hbapiitm.h diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index 91988a6d19..78f237c0fe 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -99,7 +99,7 @@ static HB_GARBAGE_FUNC( hb_pp_Destructor ) } } -static void hb_pp_StdRules( PHB_PP_STATE pState ) +static void hb_pp_StdRules( PHB_ITEM ppItem ) { static BOOL s_fInit = TRUE; static PHB_DYNS s_pDynSym; @@ -114,7 +114,7 @@ static void hb_pp_StdRules( PHB_PP_STATE pState ) { hb_vmPushDynSym( s_pDynSym ); hb_vmPushNil(); - hb_vmPushPointer( ( void * ) &pState ); + hb_vmPush( ppItem ); hb_vmDo( 1 ); } } @@ -143,6 +143,12 @@ HB_FUNC( __PP_INIT ) if( pState ) { char * szPath = hb_parc( 1 ), * szStdCh = hb_parc( 2 ); + PHB_ITEM ppItem; + + pStatePtr = ( PHB_PP_STATE * ) hb_gcAlloc( sizeof( PHB_PP_STATE ), + hb_pp_Destructor ); + * pStatePtr = pState; + ppItem = hb_itemPutPtrGC( NULL, ( void * ) pStatePtr ); hb_pp_init( pState, TRUE, 0, NULL, NULL, NULL, hb_pp_ErrorMessage, hb_pp_Disp, NULL, NULL, NULL ); @@ -150,18 +156,15 @@ HB_FUNC( __PP_INIT ) if( szPath ) hb_pp_addSearchPath( pState, szPath, TRUE ); - if( szStdCh ) + if( !szStdCh ) + hb_pp_StdRules( ppItem ); + else if( *szStdCh ) hb_pp_readRules( pState, szStdCh ); - else - hb_pp_StdRules( pState ); hb_pp_initDynDefines( pState ); hb_pp_setStdBase( pState ); - pStatePtr = ( PHB_PP_STATE * ) hb_gcAlloc( sizeof( PHB_PP_STATE ), - hb_pp_Destructor ); - * pStatePtr = pState; - hb_retptrGC( pStatePtr ); + hb_itemRelease( hb_itemReturnForward( ppItem ) ); } else hb_ret();