1
1

* Add some error checking to GET_ELEMENTS and STATUS_SET_CANCELLED

* Move the check for STATUS_IGNORE in STATUS_SET_ELEMENTS up into the
   error checking block

This commit was SVN r12460.
Этот коммит содержится в:
Jeff Squyres 2006-11-07 02:47:35 +00:00
родитель 55db17b37c
Коммит 25dab9700f
3 изменённых файлов: 27 добавлений и 8 удалений

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

@ -38,7 +38,17 @@ int MPI_Get_elements(MPI_Status *status, MPI_Datatype datatype, int *count)
size_t size;
if (MPI_PARAM_CHECK) {
int err = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == status || MPI_STATUSES_IGNORE == status ||
MPI_STATUS_IGNORE == status || NULL == count) {
err = MPI_ERR_ARG;
} else if (NULL == datatype || MPI_DATATYPE_NULL == datatype) {
err = MPI_ERR_TYPE;
} else {
OMPI_CHECK_DATATYPE_FOR_RECV(err, datatype, 1);
}
OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME);
}
*count = 0;

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

@ -34,7 +34,14 @@ static const char FUNC_NAME[] = "MPI_Status_set_cancelled";
int MPI_Status_set_cancelled(MPI_Status *status, int flag)
{
if (MPI_PARAM_CHECK) {
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (NULL == status ||
MPI_STATUS_IGNORE == status ||
MPI_STATUSES_IGNORE == status) {
rc = MPI_ERR_ARG;
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
status->_cancelled = flag;

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

@ -44,18 +44,20 @@ int MPI_Status_set_elements(MPI_Status *status, MPI_Datatype datatype,
rc = MPI_ERR_TYPE;
} else if (count < 0) {
rc = MPI_ERR_COUNT;
} else if (NULL == status ||
MPI_STATUS_IGNORE == status ||
MPI_STATUSES_IGNORE == status) {
rc = MPI_ERR_ARG;
}
OMPI_ERRHANDLER_CHECK(rc, MPI_COMM_WORLD, rc, FUNC_NAME);
}
if (status != MPI_STATUS_IGNORE) {
if( ompi_ddt_is_predefined(datatype) ) {
ompi_ddt_type_size( datatype, &size );
status->_count = (int)(count * size);
} else {
ompi_ddt_set_element_count( datatype, count, &size );
status->_count = (int)size;
}
if( ompi_ddt_is_predefined(datatype) ) {
ompi_ddt_type_size( datatype, &size );
status->_count = (int)(count * size);
} else {
ompi_ddt_set_element_count( datatype, count, &size );
status->_count = (int)size;
}
return MPI_SUCCESS;
}