diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-27 19:46:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-27 19:46:11 (GMT) |
commit | 5d795c0260d3aa38ac9e3993ec42057a46285348 (patch) | |
tree | 6392e60cf72a81491589d96c98acf873d0fa1392 | |
parent | 39641369feada2e4ca2f5c3640559a29392458db (diff) | |
download | hdf5-5d795c0260d3aa38ac9e3993ec42057a46285348.zip hdf5-5d795c0260d3aa38ac9e3993ec42057a46285348.tar.gz hdf5-5d795c0260d3aa38ac9e3993ec42057a46285348.tar.bz2 |
[svn-r17433] Description:
Bring r17432 from trunk to 1.8 branch:
Simplify dataspace cleanup code.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
(h5committested on trunk)
-rw-r--r-- | src/H5Z.c | 22 |
1 files changed, 6 insertions, 16 deletions
@@ -497,7 +497,8 @@ done: static herr_t H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_type) { - herr_t ret_value = SUCCEED; /* Return value */ + hid_t space_id = -1; /* ID for dataspace describing chunk */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5Z_prelude_callback) @@ -529,7 +530,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty if(dcpl_pline.nused > 0) { hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; /* Size of chunk dimensions */ H5S_t *space; /* Dataspace describing chunk */ - hid_t space_id; /* ID for dataspace describing chunk */ size_t u; /* Local index variable */ /* Create a data space for a chunk & set the extent */ @@ -572,10 +572,6 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check return value */ if(status <= 0) { - /* We're leaving, so close dataspace */ - if(H5I_dec_ref(space_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") - /* Indicate filter can't apply to this combination of parameters */ if(status == 0) HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") @@ -590,14 +586,9 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty /* Check if there is a "set local" callback */ if(fclass->set_local) { /* Make callback to filter's "set local" function */ - if((fclass->set_local)(dcpl_id, type_id, space_id)<0) { - /* We're leaving, so close dataspace */ - if(H5I_dec_ref(space_id, FALSE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") - + if((fclass->set_local)(dcpl_id, type_id, space_id) < 0) /* Indicate error during filter callback */ HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") - } /* end if */ } /* end if */ break; @@ -606,15 +597,14 @@ H5Z_prelude_callback(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type_t prelude_ty } /* end switch */ } /* end else */ } /* end for */ - - /* Close dataspace */ - if(H5I_dec_ref(space_id, FALSE) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") } /* end if */ } /* end if */ } /* end if */ done: + if(space_id > 0 && H5I_dec_ref(space_id, FALSE) < 0) + HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_prelude_callback() */ |