From fe09f94163088fda558b6b8b6286dda3a14ad220 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 1 Apr 2011 12:20:09 +0000 Subject: [PATCH] 2011-04-01 14:19 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/itemapi.c ! fixed compilation in MT mode with some C compilers using HB_STACK_TLS_PRELOAD * updated also hb_itemParamStore() function to set NIL to item passed by reference when is called with NULL pItem parameter. --- harbour/ChangeLog | 7 +++++++ harbour/src/vm/itemapi.c | 28 ++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7078e56fb8..edcbcbc7fe 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,13 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-01 14:19 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/vm/itemapi.c + ! fixed compilation in MT mode with some C compilers using + HB_STACK_TLS_PRELOAD + * updated also hb_itemParamStore() function to set NIL to item passed + by reference when is called with NULL pItem parameter. + 2011-04-01 13:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/vm/itemapi.c * set NIL to item passed by reference when hb_itemParamStoreForward() diff --git a/harbour/src/vm/itemapi.c b/harbour/src/vm/itemapi.c index 944580dc67..d110db5c3c 100644 --- a/harbour/src/vm/itemapi.c +++ b/harbour/src/vm/itemapi.c @@ -128,11 +128,13 @@ HB_BOOL hb_itemParamStore( HB_USHORT uiParam, PHB_ITEM pItem ) if( hb_param( uiParam, HB_IT_BYREF ) ) { + HB_STACK_TLS_PRELOAD + PHB_ITEM pDest = hb_stackItemFromBase( uiParam ); + if( pItem ) - { - HB_STACK_TLS_PRELOAD - hb_itemCopyToRef( hb_stackItemFromBase( uiParam ), pItem ); - } + hb_itemCopyToRef( pDest, pItem ); + else + hb_itemSetNil( pDest ); return HB_TRUE; } @@ -145,13 +147,13 @@ HB_BOOL hb_itemParamStoreForward( HB_USHORT uiParam, PHB_ITEM pItem ) if( hb_param( uiParam, HB_IT_BYREF ) ) { + HB_STACK_TLS_PRELOAD + PHB_ITEM pDest = hb_stackItemFromBase( uiParam ); + if( pItem ) - { - HB_STACK_TLS_PRELOAD - hb_itemMoveToRef( hb_stackItemFromBase( uiParam ), pItem ); - } + hb_itemMoveToRef( pDest, pItem ); else - hb_itemClear( hb_stackItemFromBase( uiParam ) ); + hb_itemSetNil( pDest ); return HB_TRUE; } @@ -164,14 +166,16 @@ HB_BOOL hb_itemParamStoreRelease( HB_USHORT uiParam, PHB_ITEM pItem ) if( hb_param( uiParam, HB_IT_BYREF ) ) { + HB_STACK_TLS_PRELOAD + PHB_ITEM pDest = hb_stackItemFromBase( uiParam ); + if( pItem ) { - HB_STACK_TLS_PRELOAD - hb_itemMoveToRef( hb_stackItemFromBase( uiParam ), pItem ); + hb_itemMoveToRef( pDest, pItem ); hb_itemRelease( pItem ); } else - hb_itemClear( hb_stackItemFromBase( uiParam ) ); + hb_itemSetNil( pDest ); return HB_TRUE; }