diff --git a/ompi/mpi/c/pack.c b/ompi/mpi/c/pack.c index 555f5212f0..7a8f295a6d 100644 --- a/ompi/mpi/c/pack.c +++ b/ompi/mpi/c/pack.c @@ -13,7 +13,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -45,7 +45,7 @@ static const char FUNC_NAME[] = "MPI_Pack"; int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, int outsize, int *position, MPI_Comm comm) { - int rc = MPI_SUCCESS; + int rc = MPI_SUCCESS, ret; opal_convertor_t local_convertor; struct iovec invec; unsigned int iov_count; @@ -95,14 +95,16 @@ int MPI_Pack(const void *inbuf, int incount, MPI_Datatype datatype, /* Do the actual packing */ iov_count = 1; - rc = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size ); + ret = opal_convertor_pack( &local_convertor, &invec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); OPAL_CR_EXIT_LIBRARY(); /* All done. Note that the convertor returns 1 upon success, not - OMPI_SUCCESS. */ - OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR, - comm, MPI_ERR_UNKNOWN, FUNC_NAME); + OPAL_SUCCESS. */ + if (1 != ret) { + rc = OMPI_ERROR; + } + OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME); } diff --git a/ompi/mpi/c/pack_external.c b/ompi/mpi/c/pack_external.c index 4ccffbc2b9..d7eab91552 100644 --- a/ompi/mpi/c/pack_external.c +++ b/ompi/mpi/c/pack_external.c @@ -13,7 +13,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -76,6 +76,5 @@ int MPI_Pack_external(const char datarep[], const void *inbuf, int incount, OPAL_CR_EXIT_LIBRARY(); - OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR, - MPI_COMM_WORLD, rc, FUNC_NAME); + OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/pack_external_size.c b/ompi/mpi/c/pack_external_size.c index 45044d00e5..ba6d105e6c 100644 --- a/ompi/mpi/c/pack_external_size.c +++ b/ompi/mpi/c/pack_external_size.c @@ -13,7 +13,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -66,6 +66,5 @@ int MPI_Pack_external_size(const char datarep[], int incount, datatype, size); OPAL_CR_EXIT_LIBRARY(); - OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR, - MPI_COMM_WORLD, rc, FUNC_NAME); + OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME); } diff --git a/ompi/mpi/c/unpack.c b/ompi/mpi/c/unpack.c index 2bc5894069..0d7e2a68c3 100644 --- a/ompi/mpi/c/unpack.c +++ b/ompi/mpi/c/unpack.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -79,6 +79,7 @@ int MPI_Unpack(const void *inbuf, int insize, int *position, OPAL_CR_ENTER_LIBRARY(); if( insize > 0 ) { + int ret; OBJ_CONSTRUCT( &local_convertor, opal_convertor_t ); /* the resulting convertor will be set the the position ZERO */ opal_convertor_copy_and_prepare_for_recv( ompi_mpi_local_convertor, &(datatype->super), @@ -98,17 +99,17 @@ int MPI_Unpack(const void *inbuf, int insize, int *position, /* Do the actual unpacking */ iov_count = 1; - rc = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); + ret = opal_convertor_unpack( &local_convertor, &outvec, &iov_count, &size ); *position += size; OBJ_DESTRUCT( &local_convertor ); - } else { - rc = 1; + /* All done. Note that the convertor returns 1 upon success, not + OPAL_SUCCESS. */ + if (1 != ret) { + rc = OMPI_ERROR; + } } OPAL_CR_EXIT_LIBRARY(); - /* All done. Note that the convertor returns 1 upon success, not - OMPI_SUCCESS. */ - OMPI_ERRHANDLER_RETURN((rc == 1) ? OMPI_SUCCESS : OMPI_ERROR, - comm, MPI_ERR_UNKNOWN, FUNC_NAME); + OMPI_ERRHANDLER_RETURN(rc, comm, MPI_ERR_UNKNOWN, FUNC_NAME); } diff --git a/ompi/mpi/c/unpack_external.c b/ompi/mpi/c/unpack_external.c index 2d3372b517..9f4ff80e61 100644 --- a/ompi/mpi/c/unpack_external.c +++ b/ompi/mpi/c/unpack_external.c @@ -13,7 +13,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science + * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -70,9 +70,7 @@ int MPI_Unpack_external (const char datarep[], const void *inbuf, MPI_Aint insiz rc = ompi_datatype_unpack_external(datarep, inbuf, insize, position, outbuf, outcount, datatype); - OPAL_CR_EXIT_LIBRARY(); - OMPI_ERRHANDLER_RETURN((OMPI_SUCCESS == rc) ? OMPI_SUCCESS : OMPI_ERROR, - MPI_COMM_WORLD, rc, FUNC_NAME); + OMPI_ERRHANDLER_RETURN(rc, MPI_COMM_WORLD, rc, FUNC_NAME); }