diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-16 14:15:13 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-16 14:15:13 (GMT) |
commit | 9f028ea4589cfd21ce610050c75895ed69b2ee08 (patch) | |
tree | 9eea3e34c3604d6506d6b2d3ee9af6244e659ec0 /src/H5D.c | |
parent | 6fb5f819a51f27ffc44b21e2d0e44808ba71da17 (diff) | |
download | hdf5-9f028ea4589cfd21ce610050c75895ed69b2ee08.zip hdf5-9f028ea4589cfd21ce610050c75895ed69b2ee08.tar.gz hdf5-9f028ea4589cfd21ce610050c75895ed69b2ee08.tar.bz2 |
[svn-r19399] Description:
Bring r19398 from trunk to 1.8 branch:
Clean up the internal usage H5I_dec_ref() to eliminate the sequence of
flags that has been creeping in.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Diffstat (limited to 'src/H5D.c')
-rw-r--r-- | src/H5D.c | 44 |
1 files changed, 21 insertions, 23 deletions
@@ -384,8 +384,8 @@ H5Dclose(hid_t dset_id) * dataset's ID even though the freeing function might fail. Please * see the comments in H5I_dec_ref for details. (SLU - 2010/9/7) */ - if(H5I_dec_ref(dset_id, TRUE, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't free") + if(H5I_dec_app_ref_always_close(dset_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") done: FUNC_LEAVE_API(ret_value) @@ -608,30 +608,32 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE); if(src_id < 0) { - H5I_dec_ref(dst_id, FALSE, FALSE); + H5I_dec_ref(dst_id); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") } /* end if */ /* Allocate a background buffer */ bkg_size = MAX(H5T_GET_SIZE(copied_fill.type), H5T_GET_SIZE(dset->shared->type)); if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { - H5I_dec_ref(src_id, FALSE, FALSE); - H5I_dec_ref(dst_id, FALSE, FALSE); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ /* Convert fill value */ if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { - H5I_dec_ref(src_id, FALSE, FALSE); - H5I_dec_ref(dst_id, FALSE, FALSE); + H5I_dec_ref(src_id); + H5I_dec_ref(dst_id); if(bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ /* Release local resources */ - H5I_dec_ref(src_id, FALSE, FALSE); - H5I_dec_ref(dst_id, FALSE, FALSE); + if(H5I_dec_ref(src_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") + if(H5I_dec_ref(dst_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") if(bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ @@ -647,7 +649,8 @@ H5Dget_create_plist(hid_t dset_id) done: if(ret_value < 0) if(new_dcpl_id > 0) - (void)H5I_dec_ref(new_dcpl_id, TRUE, FALSE); + if(H5I_dec_app_ref(new_dcpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") FUNC_LEAVE_API(ret_value) } /* end H5Dget_create_plist() */ @@ -726,7 +729,8 @@ H5Dget_access_plist(hid_t dset_id) done: if(ret_value < 0) if(new_dapl_id >= 0) - (void)H5I_dec_ref(new_dapl_id, TRUE, FALSE); + if(H5I_dec_app_ref(new_dapl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") FUNC_LEAVE_API(ret_value) } /* end H5Dget_access_plist() */ @@ -1032,22 +1036,16 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, *size = vlen_bufsize.size; done: - if(vlen_bufsize.fspace_id > 0) { - if(H5I_dec_ref(vlen_bufsize.fspace_id, FALSE, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - } /* end if */ - if(vlen_bufsize.mspace_id > 0) { - if(H5I_dec_ref(vlen_bufsize.mspace_id, FALSE, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - } /* end if */ + if(vlen_bufsize.fspace_id > 0 && H5I_dec_ref(vlen_bufsize.fspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + if(vlen_bufsize.mspace_id > 0 && H5I_dec_ref(vlen_bufsize.mspace_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); - if(vlen_bufsize.xfer_pid > 0) { - if(H5I_dec_ref(vlen_bufsize.xfer_pid, FALSE, FALSE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list") - } /* end if */ + if(vlen_bufsize.xfer_pid > 0 && H5I_dec_ref(vlen_bufsize.xfer_pid) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref count on property list") FUNC_LEAVE_API(ret_value) } /* end H5Dvlen_get_buf_size() */ |