1
1

lam_ddt_destroy now mark the data for destruction. The data will dissapear when the last

reference will be removed.

This commit was SVN r1017.
Этот коммит содержится в:
George Bosilca 2004-04-07 21:42:50 +00:00
родитель 910a224202
Коммит 0e0b913bc7
2 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -27,7 +27,18 @@ static void __get_free_dt_struct( dt_desc_t* pData )
pData->lb = LONG_MAX;
pData->ub = LONG_MIN;
}
OBJ_CLASS_INSTANCE(lam_datatype_t, lam_object_t, __get_free_dt_struct, lam_ddt_destroy );
static void __destroy_ddt_struct( dt_desc_t** pData )
{
if( (*pData)->desc.desc != NULL ) free( (*pData)->desc.desc );
(*pData)->desc.desc = NULL;
if( (*pData)->opt_desc.desc != NULL ) free( (*pData)->opt_desc.desc );
(*pData)->opt_desc.desc = NULL;
if( (*pData)->args != NULL ) free( (*pData)->args );
(*pData)->args = NULL;
}
OBJ_CLASS_INSTANCE(lam_datatype_t, lam_object_t, __get_free_dt_struct, __destroy_ddt_struct );
dt_desc_t* lam_ddt_create( int expectedSize )
{

Просмотреть файл

@ -3,9 +3,6 @@
#include "datatype.h"
#include "datatype_internal.h"
/* This function should never be called directly. It's called by the dt_decrease_ref
* when the number of references on the data reach ZERO.
*/
int lam_ddt_destroy( dt_desc_t** dt )
{
dt_desc_t* pData = *dt;
@ -13,12 +10,7 @@ int lam_ddt_destroy( dt_desc_t** dt )
if( !(pData->flags & DT_FLAG_FOREVER) )
return LAM_ERROR;
/* I still have the data description ? */
if( pData->args != NULL ) {
fprintf( stderr, "Data description has not been removed prior to data destruction" );
}
OBJ_RELEASE( pData );
if( pData->opt_desc.desc != NULL ) free( pData->opt_desc.desc );
if( pData->desc.desc != NULL ) free( pData->desc.desc );
return 0;
}