diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fa134bd022..a033d79225 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-23 09:46 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hbpgsql/postgres.c + * harbour/contrib/hbgd/gdwrp.c + * updated code which was using hb_gcAlloc() to work with new GC API. + 2009-10-23 09:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rdd/dbfnsx/dbfnsx1.c ! fixed bug reported by Jaroslav Janik (many thanks) - if index FOR diff --git a/harbour/contrib/hbgd/gdwrp.c b/harbour/contrib/hbgd/gdwrp.c index ee9380ab99..4e0cf065d7 100644 --- a/harbour/contrib/hbgd/gdwrp.c +++ b/harbour/contrib/hbgd/gdwrp.c @@ -121,6 +121,13 @@ static HB_GARBAGE_FUNC( hb_gdImage_Destructor ) } } +static const HB_GC_FUNCS s_gcGDimageFuncs = +{ + hb_gdImage_Destructor, + hb_gcDummyMark +}; + + /* ---------------------------------------------------------------------------*/ /* function returns gdImage pointer or NULL when wrong variable is @@ -129,7 +136,7 @@ static HB_GARBAGE_FUNC( hb_gdImage_Destructor ) static gdImagePtr hb_parGdImage( int iParam ) { gdImagePtr * imPtr = - ( gdImagePtr * ) hb_parptrGC( hb_gdImage_Destructor, iParam ); + ( gdImagePtr * ) hb_parptrGC( &s_gcGDimageFuncs, iParam ); if( imPtr ) return * imPtr; @@ -145,8 +152,8 @@ static void hb_retGdImage( gdImagePtr im ) { gdImagePtr * imPtr; - imPtr = ( gdImagePtr * ) hb_gcAlloc( sizeof( gdImagePtr ), - hb_gdImage_Destructor ); + imPtr = ( gdImagePtr * ) hb_gcAllocate( sizeof( gdImagePtr ), + &s_gcGDimageFuncs ); * imPtr = im; hb_retptrGC( ( void * ) imPtr ); } @@ -160,8 +167,8 @@ static PHB_ITEM hb_gdImageItemNew( gdImagePtr im ) { gdImagePtr * imPtr; - imPtr = ( gdImagePtr * ) hb_gcAlloc( sizeof( gdImagePtr ), - hb_gdImage_Destructor ); + imPtr = ( gdImagePtr * ) hb_gcAllocate( sizeof( gdImagePtr ), + &s_gcGDimageFuncs ); * imPtr = im; return hb_itemPutPtrGC( NULL, ( void * ) imPtr ); } @@ -193,6 +200,12 @@ static HB_GARBAGE_FUNC( hb_gdFont_Destructor ) } } +static const HB_GC_FUNCS s_gcGDfontFuncs = +{ + hb_gdFont_Destructor, + hb_gcDummyMark +}; + /* ---------------------------------------------------------------------------*/ /* function returns gdFont pointer or NULL when wrong variable is @@ -201,7 +214,7 @@ static HB_GARBAGE_FUNC( hb_gdFont_Destructor ) static gdFontPtr hb_parGdFont( int iParam ) { gdFontPtr * fontPtr = - ( gdFontPtr * ) hb_parptrGC( hb_gdFont_Destructor, iParam ); + ( gdFontPtr * ) hb_parptrGC( &s_gcGDfontFuncs, iParam ); if( fontPtr ) return * fontPtr; @@ -217,8 +230,8 @@ static void hb_retGdFont( gdFontPtr font ) { gdFontPtr * fontPtr; - fontPtr = ( gdFontPtr * ) hb_gcAlloc( sizeof( gdFontPtr ), - hb_gdFont_Destructor ); + fontPtr = ( gdFontPtr * ) hb_gcAllocate( sizeof( gdFontPtr ), + &s_gcGDfontFuncs ); * fontPtr = font; hb_retptrGC( ( void * ) fontPtr ); } @@ -232,8 +245,8 @@ static PHB_ITEM hb_gdFontItemNew( gdFontPtr font ) { gdFontPtr * fontPtr; - fontPtr = ( gdFontPtr * ) hb_gcAlloc( sizeof( gdFontPtr ), - hb_gdFont_Destructor ); + fontPtr = ( gdFontPtr * ) hb_gcAllocate( sizeof( gdFontPtr ), + &s_gcGDfontFuncs ); * fontPtr = font; return hb_itemPutPtrGC( NULL, ( void * ) fontPtr ); } diff --git a/harbour/contrib/hbpgsql/postgres.c b/harbour/contrib/hbpgsql/postgres.c index 01c2b121e3..c0be083951 100644 --- a/harbour/contrib/hbpgsql/postgres.c +++ b/harbour/contrib/hbpgsql/postgres.c @@ -108,9 +108,16 @@ static HB_GARBAGE_FUNC( PGconn_release ) } } +static const HB_GC_FUNCS s_gcPGconnFuncs = +{ + PGconn_release, + hb_gcDummyMark +}; + + static void PGconn_ret( PGconn * p ) { - void ** ph = ( void ** ) hb_gcAlloc( sizeof( PGconn * ), PGconn_release ); + void ** ph = ( void ** ) hb_gcAllocate( sizeof( PGconn * ), &s_gcPGconnFuncs ); * ph = p; @@ -120,7 +127,7 @@ static void PGconn_ret( PGconn * p ) static PGconn * PGconn_par( int iParam ) { - void ** ph = ( void ** ) hb_parptrGC( PGconn_release, iParam ); + void ** ph = ( void ** ) hb_parptrGC( &s_gcPGconnFuncs, iParam ); return ph ? ( PGconn * ) * ph : NULL; } @@ -160,7 +167,7 @@ HB_FUNC( PQSETDBLOGIN ) HB_FUNC( PQCLOSE ) { - void ** ph = ( void ** ) hb_parptrGC( PGconn_release, 1 ); + void ** ph = ( void ** ) hb_parptrGC( &s_gcPGconnFuncs, 1 ); /* Check if pointer is not NULL to avoid multiple freeing */ if( ph && * ph )