diff options
author | Quincey Koziol <koziol@lbl.gov> | 2020-08-20 22:08:24 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@lbl.gov> | 2020-08-20 22:08:24 (GMT) |
commit | d67de87ecd15b531718b4e5642b264a5f9b6bbc4 (patch) | |
tree | fa73d11664a947abea2a8142d699cde694f57dc6 /src | |
parent | 91bd6f9a63352a700075aea1ed80b72aeaa91d09 (diff) | |
download | hdf5-d67de87ecd15b531718b4e5642b264a5f9b6bbc4.zip hdf5-d67de87ecd15b531718b4e5642b264a5f9b6bbc4.tar.gz hdf5-d67de87ecd15b531718b4e5642b264a5f9b6bbc4.tar.bz2 |
Simplify code to avoid using a boolean to free MPI types
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dchunk.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 92cdfda..52a921f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4954,11 +4954,10 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, int blocks, leftover, block_len; /* converted to int for MPI */ MPI_Aint *chunk_disp_array = NULL; int *block_lens = NULL; - MPI_Datatype mem_type, file_type; + MPI_Datatype mem_type = MPI_DATATYPE_NULL, file_type = MPI_DATATYPE_NULL; H5FD_mpio_xfer_t prev_xfer_mode; /* Previous data xfer mode */ hbool_t have_xfer_mode = FALSE; /* Whether the previous xffer mode has been retrieved */ hbool_t need_addr_sort = FALSE; - hbool_t created_mpi_datatypes = FALSE; /* Whether MPI datatypes were created */ int i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5046,9 +5045,6 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&mem_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - - /* Indicate that the MPI types were created */ - created_mpi_datatypes = TRUE; } /* end if */ else { /* Set up file & memory MPI types, to participate in collective write */ @@ -5086,12 +5082,12 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* free things */ - if(created_mpi_datatypes) { + if(MPI_DATATYPE_NULL != file_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(MPI_DATATYPE_NULL != mem_type) if(MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - } /* end if */ H5MM_xfree(chunk_disp_array); H5MM_xfree(block_lens); |