diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-16 14:02:19 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-16 14:02:19 (GMT) |
commit | 1914737e0658d642c1ef2e48c6162fa7cc400c64 (patch) | |
tree | d514c5e86096148b10b67f5e178dce87a7625d4d /src/H5D.c | |
parent | e5575571d4faaee78c67fc7dbae7d8229b1bfb94 (diff) | |
download | hdf5-1914737e0658d642c1ef2e48c6162fa7cc400c64.zip hdf5-1914737e0658d642c1ef2e48c6162fa7cc400c64.tar.gz hdf5-1914737e0658d642c1ef2e48c6162fa7cc400c64.tar.bz2 |
[svn-r19398] Descriptino:
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/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, 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
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, 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() */ |