From a55d4632c6d0be66e607f0feb17b06dbd8292b74 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 5 May 2006 03:25:31 +0000 Subject: [PATCH] Continue the cleaning, shrink the convertor initialization function. This commit was SVN r9827. --- ompi/datatype/convertor.c | 39 ++++++++++++++++----------------------- ompi/datatype/convertor.h | 10 ---------- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/ompi/datatype/convertor.c b/ompi/datatype/convertor.c index b93278a3b0..da11e348d9 100644 --- a/ompi/datatype/convertor.c +++ b/ompi/datatype/convertor.c @@ -383,17 +383,11 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, * * I consider here that the convertor is clean, either never initialized or already cleanup. */ -int ompi_convertor_prepare( ompi_convertor_t* convertor, - const ompi_datatype_t* datatype, int32_t count, - const void* pUserBuf ) +static inline int +ompi_convertor_prepare( ompi_convertor_t* convertor, + const ompi_datatype_t* datatype, int32_t count, + const void* pUserBuf ) { - uint32_t required_stack_length = datatype->btypes[DT_LOOP] + 1; - - if( !(datatype->flags & DT_FLAG_COMMITED) ) { - /* this datatype is improper for conversion. Commit it first */ - return OMPI_ERROR; - } - convertor->pBaseBuf = (void*)pUserBuf; convertor->count = count; @@ -425,6 +419,7 @@ int ompi_convertor_prepare( ompi_convertor_t* convertor, convertor->bConverted = 0; return OMPI_SUCCESS; } + convertor->use_desc = &(datatype->opt_desc); } else { int i; uint64_t bdt_mask = datatype->bdt_used >> DT_CHAR; @@ -436,23 +431,21 @@ int ompi_convertor_prepare( ompi_convertor_t* convertor, } } convertor->remote_size *= convertor->count; - } - - /* Decide which data representation will be used for the conversion. */ - if( (NULL != datatype->opt_desc.desc) && (convertor->flags & CONVERTOR_HOMOGENEOUS) ) { - convertor->use_desc = &(datatype->opt_desc); - } else { convertor->use_desc = &(datatype->desc); } - if( required_stack_length > convertor->stack_size ) { - convertor->stack_size = required_stack_length; - convertor->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * convertor->stack_size ); - } else { - convertor->pStack = convertor->static_stack; - convertor->stack_size = DT_STATIC_STACK_SIZE; - } + { + uint32_t required_stack_length = datatype->btypes[DT_LOOP] + 1; + if( required_stack_length > convertor->stack_size ) { + convertor->stack_size = required_stack_length; + convertor->pStack = (dt_stack_t*)malloc(sizeof(dt_stack_t) * + convertor->stack_size ); + } else { + convertor->pStack = convertor->static_stack; + convertor->stack_size = DT_STATIC_STACK_SIZE; + } + } return ompi_convertor_create_stack_at_begining( convertor, ompi_ddt_local_sizes ); } diff --git a/ompi/datatype/convertor.h b/ompi/datatype/convertor.h index 5daa6e23b9..51f8b2f216 100644 --- a/ompi/datatype/convertor.h +++ b/ompi/datatype/convertor.h @@ -233,16 +233,6 @@ ompi_convertor_get_unpacked_size( const ompi_convertor_t* pConv, *pSize = pConv->remote_size; } -/* - * This function is internal to the data type engine. It should not be called from - * outside. The data preparation should use the specialized prepare_for_send and - * prepare_for_recv functions. - */ -OMPI_DECLSPEC -int ompi_convertor_prepare( ompi_convertor_t* convertor, - const struct ompi_datatype_t* datatype, int32_t count, - const void* pUserBuf ); - /* * */