From d0b8accbc1fbc533d436ddcc4de1ccc7964d55d5 Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 30 Mar 2020 13:44:44 -0500 Subject: Relax H5F_update_vfd_swmr_metadata_file() argument checking so that we can call it with num_entries == 0 and a non-NULL `index`. Delete some code that isn't necessary if `num_entries == 0 && index != NULL` is allowed. NFCI. --- src/H5Fvfd_swmr.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c index fdd2e8a..b30c721 100644 --- a/src/H5Fvfd_swmr.c +++ b/src/H5Fvfd_swmr.c @@ -912,19 +912,10 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f) * Note that this operation will restore the index to * sorted order. */ - if (f->shared->mdf_idx_entries_used + idx_entries_added > 0) { - - if ( H5F_update_vfd_swmr_metadata_file(f, - f->shared->mdf_idx_entries_used + idx_entries_added, - f->shared->mdf_idx) < 0 ) - - HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't update MD file") - } else { - - if ( H5F_update_vfd_swmr_metadata_file(f, 0, NULL) < 0 ) - - HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't update MD file") - } + if (H5F_update_vfd_swmr_metadata_file(f, + f->shared->mdf_idx_entries_used + idx_entries_added, + f->shared->mdf_idx) < 0) + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't update MD file") /* at this point the metadata file index should be sorted -- update * f->shared->mdf_idx_entries_used. @@ -1681,8 +1672,7 @@ H5F__vfd_swmr_construct_write_md_idx(H5F_t *f, uint32_t num_entries, FUNC_ENTER_STATIC - HDassert((num_entries!= 0 && index != NULL) || - (num_entries == 0 && index == NULL)); + HDassert(num_entries == 0 || index != NULL); /* Allocate space for the buffer to hold the index */ if ( (image = HDmalloc(idx_size)) == NULL ) -- cgit v0.12